Imports System.IO
Public Class MobEditor
#Region "Dimensions and Variable Declarations"
    Inherits System.Windows.Forms.Form
    Implements IMessageFilter

    Private WM_KEYDOWN As Integer = &H100
    Private WM_KEYUP As Integer = &H101

    Dim sErr As String
    Dim bAns As Boolean

    Public SENDval As String
    Public HideCombat As Boolean = False
    Public CreateAs As String
    Public WorldNum, ContinentNum, ProvinceNum, AreaNum, MapNum, SectorNum As String

    Private AtlasNodes, AtlasNodesData, MapData, ItemData, MobData, ScriptData, EmoteData As String
    Private Const VertScrollBar As Int32 = &H115
    Private Const VertScrollBar_Btm As Int32 = 7
#End Region
#Region "Functions"
    Private Declare Auto Function SendMessage Lib "user32.dll" (ByVal hwnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
    Public Function PreFilterMessage(ByRef m As Message) As Boolean Implements IMessageFilter.PreFilterMessage
        Dim keyCode As Keys = CType(CInt(m.WParam), Keys) And Keys.KeyCode
        If m.Msg = WM_KEYDOWN And keyCode = Keys.Escape Then
            Me.Close()
            Application.RemoveMessageFilter(Me) : Return True
        End If
        Return False
    End Function 'PreFilterMessage
    Public Function GetFileContents(ByVal FullPath As String, _
             Optional ByRef ErrInfo As String = "") As String

        Dim strContents As String
        Dim objReader As StreamReader
        Try
            objReader = New StreamReader(FullPath)
            strContents = objReader.ReadToEnd()
            Return strContents
            objReader.Close()
            objReader.Dispose()
        Catch Ex As Exception
            ErrInfo = Ex.Message
            MsgBox(ErrInfo, MsgBoxStyle.Critical, "ERROR!")
            Return ""
        End Try
    End Function
    Public Function SaveTextToFile(ByVal strData As String, _
     ByVal FullPath As String, _
       Optional ByVal ErrInfo As String = "") As Boolean
        Dim bAns As Boolean = False
        Dim trynum As Short = 1
        Dim objReader As StreamWriter
        While bAns = False
            Try
                objReader = New StreamWriter(FullPath)
                objReader.Write(strData)
                objReader.Close()
                bAns = True
            Catch Ex As Exception
                ErrInfo = Ex.Message
                If trynum = 1000 Then
                    MsgBox(ErrInfo, MsgBoxStyle.Critical, "ERROR!")
                    bAns = True
                End If
            End Try
        End While
        Return bAns
    End Function
#End Region
#Region "Initialize Form"
    Private Sub introtext(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Application.AddMessageFilter(Me)
        loaditems(0, e.Empty)
        MobCreature.Items.Clear()
        LoadCreatureList()
        SND("/GTemplate loaded.")
        SND("/g(Ready for editing)")
    End Sub
    Private Sub LoadCreatureList()
        Dim MobList As String
        Dim MobNum As Integer = 1
        Dim MobPart As Short = 1
        Dim LastPosition As Short = 1 'used to determine where the next string starts / ends
        If File.Exists(Replace(Debugger.DirMobs, "Mobs.TG", "TL.Creatures.TG")) Then
            MobList = GetFileContents(Replace(Debugger.DirMobs, "Mobs.TG", "TL.Creatures.TG"))
            MobNum = InStr(MobList, "0001.")
            If MobNum < 1 Then MessageBox.Show("Error 901 : Please report this to Nathaniel Inman" + Chr(13) + "nbinman@gmail.com" + Chr(13) + "<" + Replace(Debugger.DirMobs, "Mobs.TG", "TL.Creatures.TG") + ">", "Error 901 : Will Close Program After Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Error)
            MobNum = 1
            'that error message is if an Mob is asking for a Mob that isn't found in the list.
            'if that occurs it's usually because either the list of Mobs has the Mob misspelled or
            'the list of Mobs in the Mob editor has it mispelled. Mobs will never be added or
            'subtracted from the list anymore. The only reason it's external is if the Mobs
            'need to be edited slightly to ensure that they aren't too powerful or weak.
            While MobNum > 0
                If MobNum > Len(MobList) Then 'reached the end of the document, close it
                    MobNum = -2
                Else
                    If Mid(MobList, MobNum, 1) = Chr(13) Then 'Mobs are separated by a carriage return
                        MobCreature.Items.Add(Mid(MobList, LastPosition, MobNum - LastPosition))
                        LastPosition = MobNum + 2
                    ElseIf MobNum = Len(MobList) Then 'grabs the Mob if it's the last Mob of the document (affects)
                        MobCreature.Items.Add(Mid(MobList, LastPosition, MobNum - LastPosition + 1))
                    End If
                End If
                MobNum += 1
            End While
        Else
            MessageBox.Show("Error 901 : Please report this to Nathaniel Inman" + Chr(13) + "nbinman@gmail.com" + Chr(13) + "<" + Replace(Debugger.DirMobs, "Mobs.TG", "TL.Creatures.TG") + ">", "Error 901 : Will Close Program After Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Application.Exit()
        End If
    End Sub
#End Region
#Region "Form Changes"
    Private Sub racehatredchange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox17.CheckedChanged
        If CheckBox17.Checked = True Then
            MobHatred_Race.Enabled = True
        Else
            MobHatred_Race.Enabled = False
        End If
    End Sub
    Private Sub classhatredchange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox18.CheckedChanged
        If CheckBox18.Checked = True Then
            MobHatred_Class.Enabled = True
        Else
            MobHatred_Class.Enabled = False
        End If
    End Sub
    Private Sub sexhatredchange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox19.CheckedChanged
        If CheckBox19.Checked = True Then
            MobHatred_Sex.Enabled = True
        Else
            MobHatred_Sex.Enabled = False
        End If
    End Sub
    Private Sub static1change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StaticItem1change.CheckedChanged
        If StaticItem1change.Checked = True Then
            StaticItem1.Enabled = True
        Else
            StaticItem1.Enabled = False
        End If
    End Sub
    Private Sub static2change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StaticItem2change.CheckedChanged
        If StaticItem2change.Checked = True Then
            StaticItem2.Enabled = True
        Else
            StaticItem2.Enabled = False
        End If
    End Sub
    Private Sub static3change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StaticItem3change.CheckedChanged
        If StaticItem3change.Checked = True Then
            StaticItem3.Enabled = True
        Else
            StaticItem3.Enabled = False
        End If
    End Sub
    Private Sub static4change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StaticItem4change.CheckedChanged
        If StaticItem4change.Checked = True Then
            StaticItem4.Enabled = True
        Else
            StaticItem4.Enabled = False
        End If
    End Sub
    Private Sub static5change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StaticItem5change.CheckedChanged
        If StaticItem5change.Checked = True Then
            StaticItem5.Enabled = True
        Else
            StaticItem5.Enabled = False
        End If
    End Sub
    Private Sub dynam1change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DynamicItem1changed.CheckedChanged
        If DynamicItem1changed.Checked = True Then
            DynamicItem1.Enabled = True
            DefineDynam1.Enabled = True
        Else
            DynamicItem1.Enabled = False
            DefineDynam1.Enabled = False
        End If
    End Sub
    Private Sub dynam2change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DynamicItem2changed.CheckedChanged
        If DynamicItem2changed.Checked = True Then
            DynamicItem2.Enabled = True
            DefineDynam2.Enabled = True
        Else
            DynamicItem2.Enabled = False
            DefineDynam2.Enabled = False
        End If
    End Sub
    Private Sub dynam3change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DynamicItem3changed.CheckedChanged
        If DynamicItem3changed.Checked = True Then
            DynamicItem3.Enabled = True
            DefineDynam3.Enabled = True
        Else
            DynamicItem3.Enabled = False
            DefineDynam3.Enabled = False
        End If
    End Sub
    Private Sub dynam4change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DynamicItem4changed.CheckedChanged
        If DynamicItem4changed.Checked = True Then
            DynamicItem4.Enabled = True
            DefineDynam4.Enabled = True
        Else
            DynamicItem4.Enabled = False
            DefineDynam4.Enabled = False
        End If
    End Sub
    Private Sub dynam5change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DynamicItem5changed.CheckedChanged
        If DynamicItem5changed.Checked = True Then
            DynamicItem5.Enabled = True
            DefineDynam5.Enabled = True
        Else
            DynamicItem5.Enabled = False
            DefineDynam5.Enabled = False
        End If
    End Sub
    Private Sub dt1change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox12.CheckedChanged
        If CheckBox12.Checked = True Then
            a1.Enabled = True
            b1.Enabled = True
            c1.Enabled = True
            d1.Enabled = True
            e1.Enabled = True
            f1.Enabled = True
        Else
            a1.Enabled = False
            b1.Enabled = False
            c1.Enabled = False
            d1.Enabled = False
            e1.Enabled = False
            f1.Enabled = False
        End If
    End Sub
    Private Sub dt2change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox13.CheckedChanged
        If CheckBox13.Checked = True Then
            a2.Enabled = True
            b2.Enabled = True
            c2.Enabled = True
            d2.Enabled = True
            e2.Enabled = True
            f2.Enabled = True
        Else
            a2.Enabled = False
            b2.Enabled = False
            c2.Enabled = False
            d2.Enabled = False
            e2.Enabled = False
            f2.Enabled = False
        End If
    End Sub
    Private Sub dt3change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox14.CheckedChanged
        If CheckBox14.Checked = True Then
            a3.Enabled = True
            b3.Enabled = True
            c3.Enabled = True
            d3.Enabled = True
            e3.Enabled = True
            f3.Enabled = True
        Else
            a3.Enabled = False
            b3.Enabled = False
            c3.Enabled = False
            d3.Enabled = False
            e3.Enabled = False
            f3.Enabled = False
        End If
    End Sub
    Private Sub dt4change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox15.CheckedChanged
        If CheckBox15.Checked = True Then
            a4.Enabled = True
            b4.Enabled = True
            c4.Enabled = True
            d4.Enabled = True
            e4.Enabled = True
            f4.Enabled = True
        Else
            a4.Enabled = False
            b4.Enabled = False
            c4.Enabled = False
            d4.Enabled = False
            e4.Enabled = False
            f4.Enabled = False
        End If
    End Sub
    Private Sub dt5change(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox16.CheckedChanged
        If CheckBox16.Checked = True Then
            a5.Enabled = True
            b5.Enabled = True
            c5.Enabled = True
            d5.Enabled = True
            e5.Enabled = True
            f5.Enabled = True
        Else
            a5.Enabled = False
            b5.Enabled = False
            c5.Enabled = False
            d5.Enabled = False
            e5.Enabled = False
            f5.Enabled = False
        End If
    End Sub
    Private Sub mountchange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = True Then
            mountbag.Enabled = True
            MountCost1.Enabled = True
            MountCost2.Enabled = True
            MountCost3.Enabled = True
            mountspeed.Enabled = True
            mountlvlreq.Enabled = True
        Else
            mountbag.Enabled = False
            MountCost1.Enabled = False
            MountCost2.Enabled = False
            MountCost3.Enabled = False
            mountspeed.Enabled = False
            mountlvlreq.Enabled = False
        End If
    End Sub
    Private Sub statchange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox25.CheckedChanged
        If CheckBox25.Checked = True Then
            hp.Enabled = True
            wp.Enabled = True
            sp.Enabled = True
        Else
            hp.Enabled = False
            wp.Enabled = False
            sp.Enabled = False
        End If
    End Sub
    Private Sub acchange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox26.CheckedChanged
        If CheckBox26.Checked = True Then
            BashAC.Enabled = True
            SlashAC.Enabled = True
            PierceAC.Enabled = True
            FistAC.Enabled = True
            ExoticAC.Enabled = True
        Else
            BashAC.Enabled = False
            SlashAC.Enabled = False
            PierceAC.Enabled = False
            FistAC.Enabled = False
            ExoticAC.Enabled = False
        End If
    End Sub
    Private Sub AttackExpertise(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox27.CheckedChanged
        If CheckBox27.Checked = True Then
            BashStr.Enabled = True
            SlashStr.Enabled = True
            PierceStr.Enabled = True
            FistStr.Enabled = True
            ExoticStr.Enabled = True
        Else
            BashStr.Enabled = False
            SlashStr.Enabled = False
            PierceStr.Enabled = False
            FistStr.Enabled = False
            ExoticStr.Enabled = False
        End If
    End Sub
    Private Sub elementalres(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox28.CheckedChanged
        If CheckBox28.Checked = True Then
            FireRes.Enabled = True
            WaterRes.Enabled = True
            AirRes.Enabled = True
            EarthRes.Enabled = True
            SpiritRes.Enabled = True
        Else
            FireRes.Enabled = False
            WaterRes.Enabled = False
            AirRes.Enabled = False
            EarthRes.Enabled = False
            SpiritRes.Enabled = False
        End If
    End Sub
    Private Sub elementalampchange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox29.CheckedChanged
        If CheckBox29.Checked = True Then
            FireAmp.Enabled = True
            WaterAmp.Enabled = True
            AirAmp.Enabled = True
            EarthAmp.Enabled = True
            SpiritAmp.Enabled = True
        Else
            FireAmp.Enabled = False
            WaterAmp.Enabled = False
            AirAmp.Enabled = False
            EarthAmp.Enabled = False
            SpiritAmp.Enabled = False
        End If
    End Sub
    Private Sub subelementalreschange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox30.CheckedChanged
        If CheckBox30.Checked = True Then
            SubFireRes.Enabled = True
            SubWaterRes.Enabled = True
            SubAirRes.Enabled = True
            SubEarthRes.Enabled = True
            SubSpiritRes.Enabled = True
        Else
            SubFireRes.Enabled = False
            SubWaterRes.Enabled = False
            SubAirRes.Enabled = False
            SubEarthRes.Enabled = False
            SubSpiritRes.Enabled = False
        End If
    End Sub
    Private Sub subelementalampchange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox31.CheckedChanged
        If CheckBox31.Checked = True Then
            SubFireAmp.Enabled = True
            SubWaterAmp.Enabled = True
            SubAirAmp.Enabled = True
            SubEarthAmp.Enabled = True
            SubSpiritAmp.Enabled = True
        Else
            SubFireAmp.Enabled = False
            SubWaterAmp.Enabled = False
            SubAirAmp.Enabled = False
            SubEarthAmp.Enabled = False
            SubSpiritAmp.Enabled = False
        End If
    End Sub
    Private Sub levelchange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox32.CheckedChanged
        If CheckBox32.Checked = True Then
            level.Enabled = True
        Else
            level.Enabled = False
        End If
    End Sub
    Private Sub MobTempermentchange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox33.CheckedChanged
        If CheckBox33.Checked = True Then
            MobTemperment.Enabled = True
        Else
            MobTemperment.Enabled = False
        End If
    End Sub
#End Region
#Region "Define Item"
    Private Sub DefineItem1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DefineDynam1.Click
        SENDval = "1"
        MobEditorDropDynamic.ShowDialog()
    End Sub
    Private Sub DefinteItem2(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DefineDynam2.Click
        SENDval = "2"
        MobEditorDropDynamic.ShowDialog()
    End Sub
    Private Sub DefinteItem3(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DefineDynam3.Click
        SENDval = "3"
        MobEditorDropDynamic.ShowDialog()
    End Sub
    Private Sub DefineItem4(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DefineDynam4.Click
        SENDval = "4"
        MobEditorDropDynamic.ShowDialog()
    End Sub
    Private Sub DefineItem5(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DefineDynam5.Click
        SENDval = "5"
        MobEditorDropDynamic.ShowDialog()
    End Sub
#End Region
    Public Sub SND(ByVal Txt As String)
        OUTPUT.Select(Len(OUTPUT.Text), 0)
        Txt = "/B " + Txt + "/B"
        Dim Switches As Integer = -1
        Dim TempStr As String
        Dim TempStr2 As String
        Dim TempInt As Integer
        Dim TempInt2 As Integer = 0
        For TempInt = 1 To Len(Txt) Step 1
            TempStr = Mid(Txt, TempInt, 1)
            If TempStr = "/" Then
                If Mid(Txt, TempInt, 2) = "/B" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&HFF)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/b" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&H66)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/C" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&HFFFF)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/c" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&H6666)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/M" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&HFF00FF)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/m" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&H660066)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/y" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&H666600)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/Y" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&HFFFF00)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/g" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&H6600)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/G" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&HFF00)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/w" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&H666666)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/W" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&HAAAAAA)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/z" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&H333333)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/Z" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&HFFFFFF)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/R" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&HFF0000)
                    TempInt2 = TempInt
                    Switches += 1
                ElseIf Mid(Txt, TempInt, 2) = "/r" Then
                    If TempInt2 <> 0 Then
                        TempStr2 = Mid(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Txt, "/b", ""), "/B", ""), "/g", ""), "/G", ""), "/m", ""), "/M", ""), "/w", ""), "/W", ""), "/y", ""), "/Y", ""), "/z", ""), "/Z", ""), "/c", ""), "/C", ""), "/r", ""), "/R", ""), TempInt2 - Switches * 2, TempInt - TempInt2 - 2)
                        OUTPUT.SelectedText = TempStr2
                    End If
                    OUTPUT.SelectionColor = Color.FromArgb(&H660000)
                    TempInt2 = TempInt
                    Switches += 1
                End If
            End If
        Next
        OUTPUT.SelectedText = Chr(13)
        SendMessage(OUTPUT.Handle, VertScrollBar, VertScrollBar_Btm, 0)
    End Sub
    Private Sub SentientChange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Sentient.Click, NonSentient.Click
        If Sentient.Checked = True Then
            MobRace.Enabled = 1
            MobClass.Enabled = 1
            MobClassPreset.Enabled = 0
            MobCreature.Enabled = 0
        Else
            MobRace.Enabled = 0
            MobClass.Enabled = 0
            MobClassPreset.Enabled = 0
            MobCreature.Enabled = 1
        End If
    End Sub
    Private Sub deletemob(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MobData = GetFileContents(Debugger.DirMobs, sErr)
        Dim aint As Short
        Dim tmobdata As String = MobData
        Dim overwrite As Boolean = False
        Dim astr As String = ""
        Dim tmp1 As Integer
        Dim tmp2 As Integer
        Dim tmp3 As Integer
        For aint = InStr(MobData, "TOTAL#") To Len(MobData) Step 1
            If Mid(MobData, aint, 1) = "(" Then
                astr = LTrim(Str(Val(Mid(MobData, InStr(MobData, "TOTAL#") + 6, aint - InStr(MobData, "TOTAL#") - 6)) - 1))
                Exit For
            End If
        Next
        If Val(VIRID.Text) <= Val(astr) + 1 Then
            For tmp1 = 1 To Len(tmobdata) Step 1
                If Mid(tmobdata, tmp1, 6 + Len(VIRID.Text)) = "VIRID#" + VIRID.Text Then
                    tmp2 = tmp1
                End If
                If Mid(tmobdata, tmp1, 6 + Len(VIRID.Text)) = "ENDMB#" + VIRID.Text Then
                    For tmp3 = tmp2 To Len(tmobdata) Step 1
                        If Mid(tmobdata, tmp3, 5) = "%p45)" Then
                            tmp3 += 9
                            Exit For
                        End If
                    Next
                    Exit For
                End If
            Next
            If VIRID.Text <> Val(astr) + 1 Then
                For tmp1 = Val(VIRID.Text) + 1 To Val(astr) + 1 Step +1
                    tmobdata = Replace(tmobdata, "#" + LTrim(Str(tmp1)) + "(", "#" + LTrim(Str(tmp1 - 1)) + "(")
                    tmobdata = Replace(tmobdata, "VIRID#" + LTrim(Str(tmp1 - 1)) + "(" + LTrim(Str(tmp1)), "VIRID#" + LTrim(Str(tmp1 - 1)) + "(" + LTrim(Str(tmp1 - 1)))
                Next
            End If
            If Val(VIRID.Text) <= Val(astr) Then
                tmobdata = Replace(tmobdata, "TOTAL#" + LTrim(Str(Val(astr))) + "(" + LTrim(Str(Val(astr) + 1)) + ")", "TOTAL#" + LTrim(Str(Val(astr))) + "(" + LTrim(Str(Val(astr))) + ")")
                If Len(VIRID.Text) > 1 Then
                    MobData = Replace(tmobdata, Mid(tmobdata, tmp2 - Len(VIRID.Text), tmp3 - tmp2 - Len(VIRID.Text)), "", 1, 1)
                Else
                    MobData = Replace(tmobdata, Mid(tmobdata, tmp2, tmp3 - tmp2), "", 1, 1)
                End If
            Else
                tmobdata = Replace(tmobdata, "TOTAL#" + LTrim(Str(Val(astr) + 1)) + "(" + LTrim(Str(Val(astr) + 1)) + ")", "TOTAL#" + LTrim(Str(Val(astr))) + "(" + LTrim(Str(Val(astr))) + ")")
                MobData = Replace(tmobdata, Mid(tmobdata, tmp2, Len(tmobdata) - tmp2 + 4), "")
            End If
            bAns = SaveTextToFile(MobData, Debugger.DirMobs, sErr)
            SND("/GMob successfully deleted.")
            If Val(VIRID.Text) <= Val(astr) Then
                ComboBox1.Text = ComboBox1.Items(Val(VIRID.Text) - 1)
            Else
                ComboBox1.Text = ComboBox1.Items(Val(VIRID.Text) - 2)
            End If
            loadnpc(0, System.EventArgs.Empty)
        Else
            SND("/RERROR: Current mob VIRID doesn't exist.")
        End If
    End Sub
    Private Sub CompileAndSave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        MobData = GetFileContents(Debugger.DirMobs, sErr)
        Dim errornum As Short = 0
        Dim aint As Short
        Dim tmobdata As String = MobData
        Dim overwrite As Boolean = False
        Dim astr As String = ""
        If InStr(MobData, "TOTAL#") = 0 Then MobData = "TOTAL#0(0)"
        For aint = InStr(MobData, "TOTAL#") To Len(MobData) Step 1
            If Mid(MobData, aint, 1) = "(" Then
                astr = LTrim(Str(Val(Mid(MobData, InStr(MobData, "TOTAL#") + 6, aint - InStr(MobData, "TOTAL#") - 6)) + 1))
                Exit For
            End If
        Next
        SND("/GAttempting to create VIRID number " + VIRID.Text + "...")
        If Val(VIRID.Text) < Val(astr) Then
            SND("/GOverwriting VIRID number " + VIRID.Text + "...")
            overwrite = True
            MobData = ""
        ElseIf Val(VIRID.Text) = (Val(astr)) Then
            SND("/GAllocating VIRID number " + VIRID.Text + " was a success.")
            MobData = Replace(MobData, Mid(MobData, InStr(MobData, "TOTAL#"), 8 + Len(astr) * 2), "TOTAL#" + astr + "(" + astr + ")" + Chr(13))
        ElseIf Val(VIRID.Text) > Val(astr) Then
            SND("/RAllocating VIRID number " + VIRID.Text + " Failed. Out of Bounds.")
            SND("/rChange VIRID to " + astr + " to create a new one or lower to overwrite one.")
            errornum += 1
        End If
        SND("/GReserved VNUM: /Z" + VIRID.Text)
        SND("/wVIRID/z#" + VIRID.Text + "/W(/c" + VIRID.Text + "/W)")
        If VIRID.Text = "1" Then
            MobData += Mid(LTrim(Str(Val(astr) - 1)), Len(LTrim(Str(Val(astr) - 1))), 1) + ")" + Chr(13) + Chr(13) + "VIRID#" + VIRID.Text + "(" + VIRID.Text + ")"
        Else
            MobData += "5)" + Chr(13) + Chr(13) + "VIRID#" + VIRID.Text + "(" + VIRID.Text + ")"
        End If
        astr = VIRID.Text
        SND("/wSHORT/z#" + astr + "/W(/c" + MobShort.Text + "/W)")
        MobData += Chr(13) + "SHORT#" + astr + "(" + MobShort.Text + ")"
        SND("/wMNAME/z#" + astr + "/W(/c" + MobName.Text + "/W)")
        MobData += Chr(13) + "MNAME#" + astr + "(" + MobName.Text + ")"
        If MobRace.Enabled = True Then
            SND("/wPARID/z#" + astr + "/W(/c" + Mid(MobArchetype.Text, 1, 1) + "," + Mid(MobRace.Text, 1, 2) + "," + Mid(MobHatred_Race.Text, 1, 2) + "," + Mid(MobHatred_Class.Text, 1, 2) + "," + Mid(MobHatred_Sex.Text, 1, 1) + "," + Mid(MobTemperment.Text, 1, 1) + "," + Mid(MobType.Text, 1, 1) + "," + Mid(MobClass.Text, 1, 2) + "," + Mid(MobClassPreset.Text, 1, 1) + "/W)")
            MobData += Chr(13) + "PARID#" + astr + "(" + Mid(MobArchetype.Text, 1, 1) + "," + Mid(MobRace.Text, 1, 2) + "," + Mid(MobHatred_Race.Text, 1, 2) + "," + Mid(MobHatred_Class.Text, 1, 2) + "," + Mid(MobHatred_Sex.Text, 1, 1) + "," + Mid(MobTemperment.Text, 1, 1) + "," + Mid(MobType.Text, 1, 1) + "," + Mid(MobClass.Text, 1, 2) + "," + Mid(MobClassPreset.Text, 1, 1) + ")"
        Else
            SND("/wPARID/z#" + astr + "/W(/c" + Mid(MobArchetype.Text, 1, 1) + "," + Mid(MobCreature.Text, 1, 4) + "," + Mid(MobHatred_Race.Text, 1, 2) + "," + Mid(MobHatred_Class.Text, 1, 2) + "," + Mid(MobHatred_Sex.Text, 1, 1) + "," + Mid(MobTemperment.Text, 1, 1) + "," + Mid(MobType.Text, 1, 1) + "," + Mid(MobClass.Text, 1, 2) + "," + Mid(MobClassPreset.Text, 1, 1) + "/W)")
            MobData += Chr(13) + "PARID#" + astr + "(" + Mid(MobArchetype.Text, 1, 1) + "," + Mid(MobCreature.Text, 1, 4) + "," + Mid(MobHatred_Race.Text, 1, 2) + "," + Mid(MobHatred_Class.Text, 1, 2) + "," + Mid(MobHatred_Sex.Text, 1, 1) + "," + Mid(MobTemperment.Text, 1, 1) + "," + Mid(MobType.Text, 1, 1) + "," + Mid(MobClass.Text, 1, 2) + "," + Mid(MobClassPreset.Text, 1, 1) + ")"
        End If
        If Path1.Checked = True Then
            SND("/wMOBMV/z#" + astr + "/W(/c0/W)")
            MobData += Chr(13) + "MOBMV#" + astr + "(0)"
        ElseIf Path2.Checked = True Then
            SND("/wMOVMV/z#" + astr + "/W(/c1,{" + PathingBox.Text + "})")
            MobData += Chr(13) + "MOBMV#" + astr + "(1,{" + PathingBox.Text + "})"
        ElseIf Path3.Checked = True Then
            SND("/wMOVMV/z#" + astr + "/W(/c2,{" + PathingBox.Text + "})")
            MobData += Chr(13) + "MOBMV#" + astr + "(2,{" + PathingBox.Text + "})"
        ElseIf Path4.Checked = True Then
            SND("/wMOVMV/z#" + astr + "/W(/c3,{" + PathingBox.Text + "})")
            MobData += Chr(13) + "MOBMV#" + astr + "(3,{" + PathingBox.Text + "})"
        End If
        If MerchantToggle.Checked = True Then
            Dim TheLine As String = "1,"
            If MerchantSellsInventory.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MerchantFavorsClass.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MerchantFavorsGender.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MerchantFavorsRace.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MWUnlimited.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "[" + MWSovern.Text + "S" + MWDover.Text + "D" + MWVern.Text + "V],"
            End If
            If MWB.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MWS.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MWV1.Checked = True Then
                TheLine += "0,"
            ElseIf MWV2.Checked = True Then
                TheLine += "1,"
            ElseIf MWV3.Checked = True Then
                TheLine += "2,"
            End If
            If MAB.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MAS.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MAV1.Checked = True Then
                TheLine += "0,"
            ElseIf MAV2.Checked = True Then
                TheLine += "1,"
            ElseIf MAV3.Checked = True Then
                TheLine += "2,"
            End If
            If MMB.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MMS.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MMV1.Checked = True Then
                TheLine += "0"
            ElseIf MMV2.Checked = True Then
                TheLine += "1"
            ElseIf MMV3.Checked = True Then
                TheLine += "2"
            End If
            SND("/wMOBME/z#" + astr + "/W(/c" + TheLine + "/W)")
            MobData += Chr(13) + "MOBME#" + astr + "(" + TheLine + ")"
        Else
            SND("/wMOBME/z#" + astr + "/W(/c0/W)")
            MobData += Chr(13) + "MOBME#" + astr + "(0)"
        End If
        Dim statitem1 As String, statitem2 As String, statitem3 As String, statitem4 As String, statitem5 As String
        Dim dynamitem1 As String, dynamitem2 As String, dynamitem3 As String, dynamitem4 As String, dynamitem5 As String
        If DynamicItem1changed.Checked = True Then If Mid(DynamicItem1.Text, 1, 1) = "[" Then dynamitem1 = DynamicItem1.Text Else dynamitem1 = "0" Else dynamitem1 = "0"
        If DynamicItem2changed.Checked = True Then If Mid(DynamicItem2.Text, 1, 1) = "[" Then dynamitem2 = DynamicItem2.Text Else dynamitem2 = "0" Else dynamitem2 = "0"
        If DynamicItem3changed.Checked = True Then If Mid(DynamicItem3.Text, 1, 1) = "[" Then dynamitem3 = DynamicItem3.Text Else dynamitem3 = "0" Else dynamitem3 = "0"
        If DynamicItem4changed.Checked = True Then If Mid(DynamicItem4.Text, 1, 1) = "[" Then dynamitem4 = DynamicItem4.Text Else dynamitem4 = "0" Else dynamitem4 = "0"
        If DynamicItem5changed.Checked = True Then If Mid(DynamicItem5.Text, 1, 1) = "[" Then dynamitem5 = DynamicItem5.Text Else dynamitem5 = "0" Else dynamitem5 = "0"
        If StaticItem1change.Checked = True Then statitem1 = Mid(StaticItem1.Text, 1, 1) Else statitem1 = "0"
        If StaticItem2change.Checked = True Then statitem2 = Mid(StaticItem2.Text, 1, 1) Else statitem2 = "0"
        If StaticItem3change.Checked = True Then statitem3 = Mid(StaticItem3.Text, 1, 1) Else statitem3 = "0"
        If StaticItem4change.Checked = True Then statitem4 = Mid(StaticItem4.Text, 1, 1) Else statitem4 = "0"
        If StaticItem5change.Checked = True Then statitem5 = Mid(StaticItem5.Text, 1, 1) Else statitem5 = "0"
        SND("/wMOBTE/z#" + astr + "/W(/c" + statitem1 + "," + statitem2 + "," + statitem3 + "," + statitem4 + "," + statitem5 + "," + dynamitem1 + "," + dynamitem2 + "," + dynamitem3 + "," + dynamitem4 + "," + dynamitem5 + "/W)")
        MobData += Chr(13) + "MOBTE#" + astr + "(" + statitem1 + "," + statitem2 + "," + statitem3 + "," + statitem4 + "," + statitem5 + "," + dynamitem1 + "," + dynamitem2 + "," + dynamitem3 + "," + dynamitem4 + "," + dynamitem5 + ")"
        If LookD.Text <> "" Then
            SND("/wLOOKD/z#" + astr + "/W(/c" + LookD.Text + "/W)")
            MobData += Chr(13) + "LOOKD#" + astr + "(" + LookD.Text + ")"
        Else
            SND("/RERROR: LookD.txt returned 0")
            errornum += 1
        End If
        If SCRIT.Text <> "" Then
            SND("/wSCRIT/z#" + astr + "/W(/c" + SCRIT.Text + "/W)")
        Else
            SND("/RERROR: Scrit.txt returned 0")
            errornum += 1
        End If
        MobData += Chr(13) + "SCRIT#" + astr + "(" + SCRIT.Text + ")"
        Dim tempstr As String = ""
        If a1.Enabled = True Then tempstr = "/wDAMTY/z#" + astr + "/W(/c" + a1.Text + "[" + b1.Text + c1.Text + "]{" + d1.Text + "," + e1.Text + "," + f1.Text + "}"
        If a2.Enabled = True Then If a1.Enabled = True Then tempstr += "," + a2.Text + "[" + b2.Text + c2.Text + "]{" + d2.Text + "," + e2.Text + "," + f2.Text + "}" Else tempstr = "/wDAMTY/z#" + astr + "/W(/c" + a2.Text + "[" + b2.Text + c2.Text + "]{" + d2.Text + "," + e2.Text + "," + f2.Text + "}"
        If a3.Enabled = True Then If a1.Enabled = True Or a2.Enabled = True Then tempstr += "," + a3.Text + "[" + b3.Text + c3.Text + "]{" + d3.Text + "," + e3.Text + "," + f3.Text + "}" Else tempstr = "/wDAMTY/z#" + astr + "/W(/c" + a3.Text + "[" + b3.Text + c3.Text + "]{" + d3.Text + "," + e3.Text + "," + f3.Text + "}"
        If a4.Enabled = True Then If a1.Enabled = True Or a2.Enabled = True Or a3.Enabled = True Then tempstr += "," + a4.Text + "[" + b4.Text + c4.Text + "]{" + d4.Text + "," + e4.Text + "," + f4.Text + "}" Else tempstr = "/wDAMTY/z#" + astr + "/W(/c" + a4.Text + "[" + b4.Text + c4.Text + "]{" + d4.Text + "," + e4.Text + "," + f4.Text + "}"
        If a5.Enabled = True Then If a1.Enabled = True Or a2.Enabled = True Or a3.Enabled = True Or a4.Enabled = True Then tempstr += "," + a5.Text + "[" + b5.Text + c5.Text + "]{" + d5.Text + "," + e5.Text + "," + f5.Text + "}" Else tempstr = "/wDAMTY/z#" + astr + "/W(/c" + a5.Text + "[" + b5.Text + c5.Text + "]{" + d5.Text + "," + e5.Text + "," + f5.Text + "}"
        If tempstr <> "" Then : SND(tempstr + "/W)") : MobData += Chr(13) + Replace(Replace(Replace(Replace(tempstr, "/w", ""), "/W", ""), "/c", ""), "/z", "") + ")" : End If
        If BashAC.Enabled = True Then : SND("/wARMOR/z#" + astr + "/W(/cBashAC[" + BashAC.Text + "],SlashAC[" + SlashAC.Text + "],PierceAC[" + PierceAC.Text + "],FistAC[" + FistAC.Text + "],ExoticAC[" + ExoticAC.Text + "]/W)") : MobData += Chr(13) + "ARMOR#" + astr + "(BashAC[" + BashAC.Text + "],SlashAC[" + SlashAC.Text + "],PierceAC[" + PierceAC.Text + "],FistAC[" + FistAC.Text + "],ExoticAC[" + ExoticAC.Text + "])" : End If
        If BashStr.Enabled = True Then : SND("/wARMST/z#" + astr + "/W(/cBashStr[" + BashStr.Text + "],SlashStr[" + SlashStr.Text + "],PierceStr[" + PierceStr.Text + "],FistStr[" + FistStr.Text + "],ExoticStr[" + ExoticStr.Text + "]/W)") : MobData += Chr(13) + "ARMST#" + astr + "(BashStr[" + BashStr.Text + "],SlashStr[" + SlashStr.Text + "],PierceStr[" + PierceStr.Text + "],FistStr[" + FistStr.Text + "],ExoticStr[" + ExoticStr.Text + "])" : End If
        If FireRes.Enabled = True Then : SND("/wELERE/z#" + astr + "/W(/cFireRes[" + FireRes.Text + "],WaterRes[" + WaterRes.Text + "],AirRes[" + AirRes.Text + "],EarthRes[" + EarthRes.Text + "],SpiritRes[" + SpiritRes.Text + "]/W)") : MobData += Chr(13) + "ELERE#" + astr + "(FireRes[" + FireRes.Text + "],WaterRes[" + WaterRes.Text + "],AirRes[" + AirRes.Text + "],EarthRes[" + EarthRes.Text + "],SpiritRes[" + SpiritRes.Text + "])" : End If
        If FireAmp.Enabled = True Then : SND("/wELEAM/z#" + astr + "/W(/cFireAmp[" + FireAmp.Text + "],WaterAmp[" + WaterAmp.Text + "],AirAmp[" + AirAmp.Text + "],EarthAmp[" + EarthAmp.Text + "],SpiritRes[" + SpiritAmp.Text + "]/W)") : MobData += Chr(13) + "ELEAM#" + astr + "(FireAmp[" + FireAmp.Text + "],WaterAmp[" + WaterAmp.Text + "],AirAmp[" + AirAmp.Text + "],EarthAmp[" + EarthAmp.Text + "],SpiritRes[" + SpiritAmp.Text + "])" : End If
        If SubFireRes.Enabled = True Then : SND("/wSELRE/z#" + astr + "/W(/cSubFireRes[" + SubFireRes.Text + "],SubWaterRes[" + SubWaterRes.Text + "],SubAirRes[" + SubAirRes.Text + "],SubEarthRes[" + SubEarthRes.Text + "],SubSpiritRes[" + SubSpiritRes.Text + "]/W)") : MobData += Chr(13) + "SELRE#" + astr + "(SubFireRes[" + SubFireRes.Text + "],SubWaterRes[" + SubWaterRes.Text + "],SubAirRes[" + SubAirRes.Text + "],SubEarthRes[" + SubEarthRes.Text + "],SubSpiritRes[" + SubSpiritRes.Text + "])" : End If
        If SubFireAmp.Enabled = True Then : SND("/wSELAM/z#" + astr + "/W(/cSubFireAmp[" + SubFireAmp.Text + "],SubWaterAmp[" + SubWaterAmp.Text + "],SubAirAmp[" + SubAirAmp.Text + "],SubEarthAmp[" + SubEarthAmp.Text + "],SubSpiritRes[" + SubSpiritAmp.Text + "]/W)") : MobData += Chr(13) + "SELAM#" + astr + "(SubFireAmp[" + SubFireAmp.Text + "],SubWaterAmp[" + SubWaterAmp.Text + "],SubAirAmp[" + SubAirAmp.Text + "],SubEarthAmp[" + SubEarthAmp.Text + "],SubSpiritRes[" + SubSpiritAmp.Text + "])" : End If
        If CheckBox1.Checked = True Then
            SND("/wMOUNT/z#" + astr + "/W(/c" + mountbag.Text + "," + mountspeed.Text + "," + mountlvlreq.Text + "," + MountCost1.Text + "S " + MountCost2.Text + "D " + MountCost3.Text + "V/W)")
            MobData += Chr(13) + "MOUNT#" + astr + "(" + mountbag.Text + "," + mountspeed.Text + "," + mountlvlreq.Text + "," + MountCost1.Text + "S " + MountCost2.Text + "D " + MountCost3.Text + "V)"
        End If
        If hp.Enabled = True Then
            SND("/wHITPO/z#" + astr + "/W(/c" + hp.Text + "/W)")
            MobData += Chr(13) + "HITPO#" + astr + "(" + hp.Text + ")"
            SND("/wWILLP/z#" + astr + "/W(/c" + wp.Text + "/W)")
            MobData += Chr(13) + "WILLP#" + astr + "(" + wp.Text + ")"
            SND("/wSTAMP/z#" + astr + "/W(/c" + sp.Text + "/W)")
            MobData += Chr(13) + "STAMP#" + astr + "(" + sp.Text + ")"
        End If
        If level.Enabled = True Then
            SND("/wLEVEL/z#" + astr + "/W(/c" + level.Text + "/W)")
            MobData += Chr(13) + "LEVEL#" + astr + "(" + level.Text + ")"
        End If
        SND("/wWEIGH/z#" + astr + "/W(/c" + MobileWeight.Text + "/W)")
        MobData += Chr(13) + "WEIGH#" + astr + "(" + MobileWeight.Text + ")"
        MobData += Chr(13) + "ENDMB#" + astr + "(" + comments.Text + "%p45)"
        If errornum = 0 Then
            If overwrite = True Then
                Dim tmp1 As Integer
                Dim tmp2 As Integer
                Dim tmp3 As Integer
                For tmp1 = 1 To Len(tmobdata) Step 1
                    If Mid(tmobdata, tmp1, 6 + Len(VIRID.Text)) = "VIRID#" + VIRID.Text Then
                        tmp2 = tmp1
                    End If
                    If Mid(tmobdata, tmp1, 6 + Len(VIRID.Text)) = "ENDMB#" + VIRID.Text Then
                        For tmp3 = tmp2 To Len(tmobdata) Step 1
                            If Mid(tmobdata, tmp3, 5) = "%p45)" Then
                                tmp3 += 7
                                Exit For
                            End If
                        Next
                        Exit For
                    End If
                Next
                SND("/GMob successfully overwritten.")
                MobData = Replace(tmobdata, Mid(tmobdata, tmp2 - 4, tmp3 - tmp2 + 2), LTrim(MobData))
            End If
            bAns = SaveTextToFile(MobData, Debugger.DirMobs, sErr)
            ComboBox1.Text = astr + ". " + MobName.Text + " (" + MobShort.Text + ")"
            If overwrite = False Then SND("/GMob has been added to database successfully.")
        Else
            SND("/R" + LTrim(Str(errornum)) + " Errors were found.")
            SND("/RMobile was not compiled or saved.")
        End If
    End Sub
    Private Sub FindNPCList(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.DropDown
        ComboBox1.Items.Clear()
        ComboBox1.Items.Add("0. Clear Current Template")
        Dim int2 As Integer
        Dim int3 As Integer
        Dim int4 As Integer
        Dim CurNum As Integer = 1
        Dim str1 As String = Replace(Str(CurNum), " ", "")
        MobData = GetFileContents(Debugger.DirMobs, sErr)
        Dim astr As String = ""
        Dim aint As Integer
        Dim mshort As String = ""
        For aint = InStr(MobData, "TOTAL#") To Len(MobData) Step 1
            If Mid(MobData, aint, 1) = "(" Then
                astr = LTrim(Str(Val(Mid(MobData, InStr(MobData, "TOTAL#") + 6, aint - InStr(MobData, "TOTAL#") - 6))))
                MobData = Replace(MobData, Mid(MobData, InStr(MobData, "TOTAL#"), 8 + Len(astr) * 2), "TOTAL#" + astr + "(" + astr + ")")
                Exit For
            End If
        Next
        For int2 = 1 To Val(astr) Step 1
            If InStr(MobData, "MNAME#" + LTrim(Str(int2))) > 0 Then
                For int3 = InStr(MobData, "MNAME#" + LTrim(Str(int2))) To Len(MobData) Step 1
                    If Mid(MobData, int3, 1) = ")" Then
                        For int4 = InStr(MobData, "SHORT#" + LTrim(Str(int2))) To Len(MobData) Step 1
                            If Mid(MobData, int4, 1) = ")" Then
                                mshort = Mid(MobData, InStr(MobData, "SHORT#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int4 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(MobData, "SHORT#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))))
                                Exit For
                            End If
                        Next
                        ComboBox1.Items.Add(LTrim(Str(int2)) + ". " + Mid(MobData, InStr(MobData, "MNAME#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int3 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(MobData, "MNAME#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2)))) + " (" + mshort + ")")
                        Exit For
                    End If
                Next
            End If
        Next
    End Sub
    Private Sub ToggleDropType(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MobClassPreset.DropDown
        MobClassPreset.Items.Clear()
        MobClassPreset.Items.Add("00. Doesn't use skills")
        MobClassPreset.Items.Add("01. Priest Preset")
        MobClassPreset.Items.Add("02. Deacon Preset")
        MobClassPreset.Items.Add("03. Archdeacon Preset")
        MobClassPreset.Items.Add("04. Bishop Preset")
        MobClassPreset.Items.Add("05. Archbishop Preset")
        MobClassPreset.Items.Add("06. Woodsman Preset")
        MobClassPreset.Items.Add("07. Tracker Preset")
        MobClassPreset.Items.Add("08. Ranger Preset")
        MobClassPreset.Items.Add("09. Druit Preset")
        MobClassPreset.Items.Add("10. Druid Preset")
        MobClassPreset.Items.Add("11. Gravedigger Preset")
        MobClassPreset.Items.Add("12. Ritualist Preset")
        MobClassPreset.Items.Add("13. Warlock Preset")
        MobClassPreset.Items.Add("14. Necromancer Preset")
        MobClassPreset.Items.Add("15. Liche Preset")
        MobClassPreset.Items.Add("16. Mageling Preset")
        MobClassPreset.Items.Add("17. Mage Preset")
        MobClassPreset.Items.Add("18. Wizard Preset")
        MobClassPreset.Items.Add("19. Magus Preset")
        MobClassPreset.Items.Add("20. Supreme Magi Preset")
        MobClassPreset.Items.Add("21. Hermit Preset")
        MobClassPreset.Items.Add("22. Spellbreaker Preset")
        MobClassPreset.Items.Add("23. Soulreaver Preset")
        MobClassPreset.Items.Add("24. Demi-Psion Preset")
        MobClassPreset.Items.Add("25. Psion Preset")
        MobClassPreset.Items.Add("26. Elementalist Preset")
        MobClassPreset.Items.Add("27. Nihilist Preset")
        MobClassPreset.Items.Add("28. Sorceror Preset")
        MobClassPreset.Items.Add("29. Arcanist Preset")
        MobClassPreset.Items.Add("30. Myrmidon Preset")
        MobClassPreset.Items.Add("31. Headhunter Preset")
        MobClassPreset.Items.Add("32. Mercenary Preset")
        MobClassPreset.Items.Add("33. Savant Preset")
        MobClassPreset.Items.Add("34. Sexton Preset")
        MobClassPreset.Items.Add("35. Warlord Preset")
        MobClassPreset.Items.Add("36. Plainsman Preset")
        MobClassPreset.Items.Add("37. Barbarian Preset")
        MobClassPreset.Items.Add("38. Avenger Preset")
        MobClassPreset.Items.Add("39. Warmonger Preset")
        MobClassPreset.Items.Add("40. Berserker Preset")
        MobClassPreset.Items.Add("41. Pickpocket Preset")
        MobClassPreset.Items.Add("42. Rogue Preset")
        MobClassPreset.Items.Add("43. Thief Preset")
        MobClassPreset.Items.Add("44. Assassin Preset")
        MobClassPreset.Items.Add("45. Shadow Walker Preset")
        MobClassPreset.Items.Add("46. Page Preset")
        MobClassPreset.Items.Add("47. Squire Preset")
        MobClassPreset.Items.Add("48. Knight Preset")
        MobClassPreset.Items.Add("49. Centurion Preset")
        MobClassPreset.Items.Add("50. Templar Preset")
        MobClassPreset.Items.Add("51. Scout Preset")
        MobClassPreset.Items.Add("52. Nu-Dosai Preset")
        MobClassPreset.Items.Add("53. Nubo-Medusai Preset")
        MobClassPreset.Items.Add("54. Ado-Mendusai Preset")
        MobClassPreset.Items.Add("55. Saedu-Morusai Preset")
        MobClassPreset.Items.Add("56. Runescribe Preset")
        MobClassPreset.Items.Add("57. Draconian Preset")
        MobClassPreset.Items.Add("58. Paek'oth Preset")
        MobClassPreset.Items.Add("59. Daek'oth Preset")
        MobClassPreset.Items.Add("60. Tzaek'oth Preset")
        MobClassPreset.Items.Add("61. Monk Preset")
        MobClassPreset.Items.Add("62. Dosai Preset")
        MobClassPreset.Items.Add("63. Medusai Preset")
        MobClassPreset.Items.Add("64. Mendusai Preset")
        MobClassPreset.Items.Add("65. Morusai Preset")
        MobClassPreset.Items.Add("66. Minstrel Preset")
        MobClassPreset.Items.Add("67. Bard Preset")
        MobClassPreset.Items.Add("68. Harlequin Preset")
        MobClassPreset.Items.Add("69. Bladesinger Preset")
        MobClassPreset.Items.Add("70. Blademaster Preset")
    End Sub
    Private Sub loadnpc(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        Dim npcnum As String = ""
        Dim mscstr As String = ""
        Dim stepnum As Short = 0
        Dim tmp0 As Integer
        Dim tmp1 As Integer
        Dim tmp2 As Integer
        Dim tmp3 As Integer
        If ComboBox1.Text <> "0. Clear Current Template" Then
            For tmp1 = 1 To Len(ComboBox1.Text)
                If Mid(ComboBox1.Text, tmp1, 1) = "." Then
                    npcnum = Mid(ComboBox1.Text, 1, tmp1 - 1)
                    Exit For
                End If
            Next
            SND("/GLoading mobile number " + npcnum + "...")
            MobData = GetFileContents(Debugger.DirMobs, sErr)
            VIRID.Text = npcnum
            VIRID.Enabled = True
            tmp0 = InStr(MobData, "SHORT#" + npcnum + "(")
            If tmp0 > 0 Then
                For tmp1 = InStr(MobData, "SHORT#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        MobShort.Text = Mid(MobData, InStr(MobData, "SHORT#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "SHORT#" + npcnum + "(") - 7 - Len(npcnum))
                        Exit For
                    End If
                Next
            End If
            tmp0 = InStr(MobData, "MNAME#" + npcnum + "(")
            If tmp0 > 0 Then
                For tmp1 = InStr(MobData, "MNAME#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        MobName.Text = Mid(MobData, InStr(MobData, "MNAME#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "MNAME#" + npcnum + "(") - 7 - Len(npcnum))
                        Exit For
                    End If
                Next
            End If
            tmp0 = InStr(MobData, "PARID#" + npcnum + "(")
            If tmp0 > 0 Then : stepnum = 0
                For tmp1 = InStr(MobData, "PARID#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        mscstr = Mid(MobData, InStr(MobData, "PARID#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "PARID#" + npcnum + "(") - 7 - Len(npcnum))
                        For tmp2 = 1 To Len(mscstr) + 1 Step 1
                            If Mid(mscstr + ",", tmp2, 1) = "," Then
                                If stepnum = 0 Then
                                    MobArchetype.Text = MobArchetype.Items(Val(Mid(mscstr, 1, tmp2 - 1)))
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 1 Then
                                    If Len(Mid(mscstr, tmp3, tmp2 - tmp3)) = 2 Then
                                        Sentient.Checked = True
                                        MobCreature.Enabled = False
                                        MobRace.Enabled = True
                                        MobRace.Text = MobRace.Items(Val(Mid(mscstr, tmp3, tmp2 - tmp3)))
                                        tmp3 = tmp2 + 1
                                        stepnum += 1
                                    Else
                                        NonSentient.Checked = True
                                        MobRace.Enabled = False
                                        MobCreature.Enabled = True
                                        MobCreature.Text = MobCreature.Items(Val(Mid(mscstr, tmp3, tmp2 - tmp3)))
                                        tmp3 = tmp2 + 1
                                        stepnum += 1
                                    End If
                                ElseIf stepnum = 2 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) <> "15" Then : MobHatred_Race.Enabled = True : CheckBox17.Checked = True : Else : MobHatred_Race.Enabled = False : CheckBox17.Checked = False : End If
                                    MobHatred_Race.Text = MobHatred_Race.Items(Val(Mid(mscstr, tmp3, tmp2 - tmp3)))
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 3 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) <> "00" Then : MobHatred_Class.Enabled = True : CheckBox18.Checked = True : Else : MobHatred_Class.Enabled = False : CheckBox18.Checked = False : End If
                                    MobHatred_Class.Text = MobHatred_Class.Items(Val(Mid(mscstr, tmp3, tmp2 - tmp3)))
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 4 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) <> "0" Then : MobHatred_Sex.Enabled = True : CheckBox19.Checked = True : Else : MobHatred_Sex.Enabled = False : CheckBox19.Checked = False : End If
                                    MobHatred_Sex.Text = MobHatred_Sex.Items(Val(Mid(mscstr, tmp3, tmp2 - tmp3)))
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 5 Then
                                    MobTemperment.Enabled = True : CheckBox33.Checked = True
                                    MobTemperment.Text = MobTemperment.Items(Val(Mid(mscstr, tmp3, tmp2 - tmp3)))
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 6 Then
                                    MobType.Text = MobType.Items(Val(Mid(mscstr, tmp3, tmp2 - tmp3)))
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 7 Then
                                    MobClass.Text = MobClass.Items(Val(Mid(mscstr, tmp3, tmp2 - tmp3)))
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 8 Then
                                    MobClassPreset.Text = MobClassPreset.Items(Val(Mid(mscstr, tmp3, tmp2 - tmp3)))
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                    Exit For
                                End If
                            End If
                        Next
                        Exit For
                    End If
                Next
            End If
            tmp0 = InStr(MobData, "MOBMV#" + npcnum + "(")
            If tmp0 > 0 Then : stepnum = 0
                For tmp1 = InStr(MobData, "MOBMV#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        mscstr = Mid(MobData, InStr(MobData, "MOBMV#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "MOBMV#" + npcnum + "(") - 7 - Len(npcnum))
                        For tmp2 = 1 To Len(mscstr) + 1 Step 1
                            If Mid(mscstr + ",", tmp2, 1) = "," Then
                                If stepnum = 0 Then
                                    If Mid(mscstr, 1, tmp2 - 1) = "0" Then
                                        Path1.Checked = True
                                        stepnum = -1
                                    ElseIf Mid(mscstr, 1, tmp2 - 1) = "1" Then
                                        Path2.Checked = True
                                        stepnum += 1
                                    ElseIf Mid(mscstr, 1, tmp2 - 1) = "2" Then
                                        Path3.Checked = True
                                        stepnum += 1
                                    ElseIf Mid(mscstr, 1, tmp2 - 1) = "3" Then
                                        Path4.Checked = True
                                        stepnum += 1
                                    End If
                                    tmp3 = tmp2 + 1
                                ElseIf stepnum = 1 Then
                                    PathingBox.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                End If
                            End If
                        Next
                        Exit For
                    End If
                Next
            End If
            tmp0 = InStr(MobData, "MOBME#" + npcnum + "(")
            If tmp0 > 0 Then : stepnum = 0
                For tmp1 = InStr(MobData, "MOBME#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        mscstr = Mid(MobData, InStr(MobData, "MOBME#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "MOBME#" + npcnum + "(") - 7 - Len(npcnum))
                        For tmp2 = 1 To Len(mscstr) + 1 Step 1
                            If Mid(mscstr + ",", tmp2, 1) = "," Then
                                If stepnum = 0 Then
                                    If Mid(mscstr, 1, tmp2 - 1) = "0" Then
                                        MerchantToggle.Checked = False
                                        MWB.Checked = True
                                        MWS.Checked = False
                                        MWV1.Checked = True
                                        MAB.Checked = True
                                        MAS.Checked = False
                                        MAV1.Checked = True
                                        MMB.Checked = True
                                        MMS.Checked = False
                                        MMV1.Checked = True
                                        MerchantFavorsClass.Checked = True
                                        MerchantFavorsGender.Checked = True
                                        MerchantFavorsRace.Checked = True
                                        MerchantSellsInventory.Checked = True
                                        MWUnlimited.Checked = True
                                        MWSovern.Text = ""
                                        MWDover.Text = ""
                                        MWVern.Text = ""
                                        stepnum = -1
                                    ElseIf Mid(mscstr, 1, tmp2 - 1) = "1" Then
                                        MerchantToggle.Checked = True
                                        stepnum += 1
                                    End If
                                    tmp3 = tmp2 + 1
                                ElseIf stepnum = 1 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MerchantSellsInventory.Checked = False
                                    Else
                                        MerchantSellsInventory.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 2 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MerchantFavorsClass.Checked = False
                                    Else
                                        MerchantFavorsClass.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 3 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MerchantFavorsGender.Checked = False
                                    Else
                                        MerchantFavorsGender.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 4 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MerchantFavorsRace.Checked = False
                                    Else
                                        MerchantFavorsRace.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 5 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "1" Then
                                        MWSovern.Text = ""
                                        MWDover.Text = ""
                                        MWVern.Text = ""
                                        MWUnlimited.Checked = True
                                    Else
                                        Dim tmp10 As Integer, tmpA As String = Mid(mscstr, tmp3, tmp2 - tmp3), tmp11 As Integer = 0
                                        For tmp10 = 1 To Len(tmpA) Step 1
                                            If Mid(tmpA, tmp10, 1) = "S" Then
                                                MWSovern.Text = Mid(tmpA, 1, tmp10 - 1)
                                                tmp11 = tmp10 + 1
                                            ElseIf Mid(tmpA, tmp10, 1) = "D" Then
                                                MWDover.Text = Mid(tmpA, tmp11, tmp10 - tmp11)
                                                tmp11 = tmp10 + 1
                                            ElseIf Mid(tmpA, tmp10, 1) = "V" Then
                                                MWVern.Text = Mid(tmpA, tmp11, tmp10 - tmp11)
                                                Exit For
                                            End If
                                        Next
                                        MWSovern.Enabled = True
                                        MWDover.Enabled = True
                                        MWVern.Enabled = True
                                        MWUnlimited.Checked = False
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 6 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MWB.Checked = False
                                    Else
                                        MWB.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 7 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MWS.Checked = False
                                    Else
                                        MWS.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 8 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MWV1.Checked = True
                                    ElseIf Mid(mscstr, tmp3, tmp2 - tmp3) = "1" Then
                                        MWV2.Checked = True
                                    Else
                                        MWV3.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 9 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MAB.Checked = False
                                    Else
                                        MAB.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 10 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MAS.Checked = False
                                    Else
                                        MAS.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 11 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MAV1.Checked = True
                                    ElseIf Mid(mscstr, tmp3, tmp2 - tmp3) = "1" Then
                                        MAV2.Checked = True
                                    Else
                                        MAV3.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 12 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MMB.Checked = False
                                    Else
                                        MMB.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 13 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MMS.Checked = False
                                    Else
                                        MMS.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 14 Then
                                    If Mid(mscstr, tmp3, tmp2 - tmp3) = "0" Then
                                        MMV1.Checked = True
                                    ElseIf Mid(mscstr, tmp3, tmp2 - tmp3) = "1" Then
                                        MMV2.Checked = True
                                    Else
                                        MMV3.Checked = True
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                End If
                            End If
                        Next
                        Exit For
                    End If
                Next
            End If
            tmp0 = InStr(MobData, "MOBTE#" + npcnum + "(")
            Dim temp0 As Integer, temp1 As Integer, started As Boolean = False
            If tmp0 > 0 Then : stepnum = 0
                For tmp1 = InStr(MobData, "MOBTE#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        mscstr = Mid(MobData, InStr(MobData, "MOBTE#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "MOBTE#" + npcnum + "(") - 7 - Len(npcnum))
                        For tmp2 = 1 To Len(mscstr) + 1 Step 1
                            If Mid(mscstr + ",", tmp2, 1) = "," Then
                                If stepnum = 0 Then
                                    If Mid(mscstr, 1, tmp2 - 1) <> "0" Then : StaticItem1.Text = StaticItem1.Items(Val(Mid(mscstr, 1, tmp2 - 1))) : StaticItem1.Enabled = True : StaticItem1change.Checked = True : Else : StaticItem1.Enabled = False : StaticItem1change.Checked = False : StaticItem1.Text = "0. No Defined Item" : End If
                                    tmp3 = tmp2
                                    stepnum += 1
                                ElseIf stepnum = 1 Then
                                    If Mid(mscstr, tmp3 + 1, tmp2 - tmp3 - 1) <> "0" Then : StaticItem2.Text = StaticItem2.Items(Val(Mid(mscstr, tmp3 + 1, tmp2 - tmp3 - 1))) : StaticItem2.Enabled = True : StaticItem2change.Checked = True : Else : StaticItem2.Enabled = False : StaticItem2change.Checked = False : StaticItem2.Text = "0. No Defined Item" : End If
                                    tmp3 = tmp2
                                    stepnum += 1
                                ElseIf stepnum = 2 Then
                                    If Mid(mscstr, tmp3 + 1, tmp2 - tmp3 - 1) <> "0" Then : StaticItem3.Text = StaticItem3.Items(Val(Mid(mscstr, tmp3 + 1, tmp2 - tmp3 - 1))) : StaticItem3.Enabled = True : StaticItem3change.Checked = True : Else : StaticItem3.Enabled = False : StaticItem3.Text = "0. No Defined Item" : StaticItem3change.Checked = False : End If
                                    tmp3 = tmp2
                                    stepnum += 1
                                ElseIf stepnum = 3 Then
                                    If Mid(mscstr, tmp3 + 1, tmp2 - tmp3 - 1) <> "0" Then : StaticItem4.Text = StaticItem4.Items(Val(Mid(mscstr, tmp3 + 1, tmp2 - tmp3 - 1))) : StaticItem4.Enabled = True : StaticItem4change.Checked = True : Else : StaticItem4.Enabled = False : StaticItem4.Text = "0. No Defined Item" : StaticItem4change.Checked = False : End If
                                    tmp3 = tmp2
                                    stepnum += 1
                                ElseIf stepnum = 4 Then
                                    If Mid(mscstr, tmp3 + 1, tmp2 - tmp3 - 1) <> "0" Then : StaticItem5.Text = StaticItem5.Items(Val(Mid(mscstr, tmp3 + 1, tmp2 - tmp3 - 1))) : StaticItem5.Enabled = True : StaticItem5change.Checked = True : Else : StaticItem5.Enabled = False : StaticItem5.Text = "0. No Defined Item" : StaticItem5change.Checked = False : End If
                                    tmp3 = tmp2
                                    stepnum += 1
                                ElseIf stepnum = 5 Then
                                    For temp0 = tmp2 - 2 To Len(mscstr) Step 1
                                        If Mid(mscstr, temp0, 1) = "[" Then
                                            started = True
                                            temp1 = temp0
                                        ElseIf Mid(mscstr, temp0, 1) = "]" Then
                                            DynamicItem1.Text = Mid(mscstr, temp1, temp0 - temp1 + 1)
                                            DynamicItem1.Enabled = True
                                            DynamicItem1changed.Checked = True
                                            tmp2 = temp0 + 1
                                            started = False
                                            Exit For
                                        ElseIf Mid(mscstr, temp0, 1) = "0" And started = False Then
                                            DynamicItem1.Enabled = False
                                            DynamicItem1.Text = "0. No Defined Item"
                                            DynamicItem1changed.Checked = False
                                            Exit For
                                        End If
                                    Next
                                    stepnum += 1
                                ElseIf stepnum = 6 Then
                                    For temp0 = tmp2 - 2 To Len(mscstr) Step 1
                                        If Mid(mscstr, temp0, 1) = "[" Then
                                            started = True
                                            temp1 = temp0
                                        ElseIf Mid(mscstr, temp0, 1) = "]" Then
                                            DynamicItem2.Text = Mid(mscstr, temp1, temp0 - temp1 + 1)
                                            DynamicItem2.Enabled = True
                                            DynamicItem2changed.Checked = True
                                            tmp2 = temp0 + 1
                                            started = False
                                            Exit For
                                        ElseIf Mid(mscstr, temp0, 1) = "0" And started = False Then
                                            DynamicItem2.Enabled = False
                                            DynamicItem2.Text = "0. No Defined Item"
                                            DynamicItem2changed.Checked = False
                                            Exit For
                                        End If
                                    Next
                                    stepnum += 1
                                ElseIf stepnum = 7 Then
                                    For temp0 = tmp2 - 2 To Len(mscstr) Step 1
                                        If Mid(mscstr, temp0, 1) = "[" Then
                                            started = True
                                            temp1 = temp0
                                        ElseIf Mid(mscstr, temp0, 1) = "]" Then
                                            DynamicItem3.Text = Mid(mscstr, temp1, temp0 - temp1 + 1)
                                            DynamicItem3.Enabled = True
                                            DynamicItem3changed.Checked = True
                                            tmp2 = temp0 + 1
                                            started = False
                                            Exit For
                                        ElseIf Mid(mscstr, temp0, 1) = "0" And started = False Then
                                            DynamicItem3.Enabled = False
                                            DynamicItem3.Text = "0. No Defined Item"
                                            DynamicItem3changed.Checked = False
                                            Exit For
                                        End If
                                    Next
                                    stepnum += 1
                                ElseIf stepnum = 8 Then
                                    For temp0 = tmp2 - 2 To Len(mscstr) Step 1
                                        If Mid(mscstr, temp0, 1) = "[" Then
                                            started = True
                                            temp1 = temp0
                                        ElseIf Mid(mscstr, temp0, 1) = "]" Then
                                            DynamicItem4.Text = Mid(mscstr, temp1, temp0 - temp1 + 1)
                                            DynamicItem4.Enabled = True
                                            DynamicItem4changed.Checked = True
                                            tmp2 = temp0 + 1
                                            started = False
                                            Exit For
                                        ElseIf Mid(mscstr, temp0, 1) = "0" And started = False Then
                                            DynamicItem4.Enabled = False
                                            DynamicItem4.Text = "0. No Defined Item"
                                            DynamicItem4changed.Checked = False
                                            Exit For
                                        End If
                                    Next
                                    stepnum += 1
                                ElseIf stepnum = 9 Then
                                    For temp0 = tmp2 - 2 To Len(mscstr) Step 1
                                        If Mid(mscstr, temp0, 1) = "[" Then
                                            started = True
                                            temp1 = temp0
                                        ElseIf Mid(mscstr, temp0, 1) = "]" Then
                                            DynamicItem5.Text = Mid(mscstr, temp1, temp0 - temp1 + 1)
                                            DynamicItem5.Enabled = True
                                            DynamicItem5changed.Checked = True
                                            tmp2 = temp0 + 1
                                            started = False
                                            Exit For
                                        ElseIf Mid(mscstr, temp0, 1) = "0" And started = False Then
                                            DynamicItem5.Enabled = False
                                            DynamicItem5.Text = "0. No Defined Item"
                                            DynamicItem5changed.Checked = False
                                            Exit For
                                        End If
                                    Next
                                    stepnum = -1
                                    Exit For : Exit For
                                End If
                            End If
                        Next
                        Exit For
                    End If
                Next
            End If
            tmp0 = InStr(MobData, "LOOKD#" + npcnum + "(")
            If tmp0 > 0 Then
                For tmp1 = InStr(MobData, "LOOKD#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        LookD.Text = Mid(MobData, InStr(MobData, "LOOKD#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "LOOKD#" + npcnum + "(") - 7 - Len(npcnum))
                        Exit For
                    End If
                Next
            End If
            tmp0 = InStr(MobData, "SCRIT#" + npcnum + "(")
            If tmp0 > 0 Then
                For tmp1 = InStr(MobData, "SCRIT#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        scriptload(0, System.EventArgs.Empty)
                        SCRIT.Text = SCRIT.Items(Val(Mid(MobData, InStr(MobData, "SCRIT#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "SCRIT#" + npcnum + "(") - 7 - Len(npcnum))) - 1)
                        Exit For
                    End If
                Next
            End If
            tmp0 = InStr(MobData, "DAMTY#" + npcnum + "(")
            If tmp0 > 0 Then : stepnum = 0 : CheckBox12.Checked = False : CheckBox13.Checked = False : CheckBox14.Checked = False : CheckBox15.Checked = False : CheckBox16.Checked = False
                For tmp1 = InStr(MobData, "DAMTY#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        mscstr = Mid(MobData, InStr(MobData, "DAMTY#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "DAMTY#" + npcnum + "(") - 7 - Len(npcnum))
                        For tmp2 = 1 To Len(mscstr) + 1 Step 1
                            If Mid(mscstr + ",", tmp2, 1) = "," Then
                                If stepnum = 2 Then : CheckBox12.Checked = True
                                    Dim tmp4 As Short
                                    Dim tmp5 As Short = 0
                                    Dim tmp6 As Short
                                    Dim tmpstr As String = Mid(mscstr, 1, tmp2 - 1)
                                    For tmp4 = 1 To Len(tmpstr) Step 1
                                        If Mid(tmpstr, tmp4, 1) = "[" Then
                                            a1.Text = Mid(tmpstr, 1, tmp4 - 1)
                                            tmp6 = tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "d" Then
                                            b1.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "]" Then
                                            c1.Text = "d" + Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "{" Then
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "," Then
                                            If tmp5 = 0 Then
                                                d1.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                                tmp6 = +tmp4 + 1
                                                tmp5 += 1
                                            Else
                                                e1.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                                tmp6 = +tmp4 + 1
                                            End If
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "}" Then
                                            f1.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                            Exit For
                                        End If
                                    Next
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 5 Then : CheckBox13.Checked = True
                                    Dim tmp4 As Short
                                    Dim tmp5 As Short = 0
                                    Dim tmp6 As Short = tmp3
                                    Dim tmpstr As String = Mid(mscstr, 1, tmp2 - 1)
                                    For tmp4 = tmp3 To Len(tmpstr) Step 1
                                        If Mid(tmpstr, tmp4, 1) = "[" Then
                                            a2.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "d" Then
                                            b2.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "]" Then
                                            c2.Text = "d" + Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "{" Then
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "," Then
                                            If tmp5 = 0 Then
                                                d2.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                                tmp6 = +tmp4 + 1
                                                tmp5 += 1
                                            Else
                                                e2.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                                tmp6 = +tmp4 + 1
                                            End If
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "}" Then
                                            f2.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                            Exit For
                                        End If
                                    Next
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 8 Then : CheckBox14.Checked = True
                                    Dim tmp4 As Short
                                    Dim tmp5 As Short = 0
                                    Dim tmp6 As Short = tmp3
                                    Dim tmpstr As String = Mid(mscstr, 1, tmp2 - 1)
                                    For tmp4 = tmp3 To Len(tmpstr) Step 1
                                        If Mid(tmpstr, tmp4, 1) = "[" Then
                                            a3.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "d" Then
                                            b3.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "]" Then
                                            c3.Text = "d" + Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "{" Then
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "," Then
                                            If tmp5 = 0 Then
                                                d3.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                                tmp6 = +tmp4 + 1
                                                tmp5 += 1
                                            Else
                                                e3.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                                tmp6 = +tmp4 + 1
                                            End If
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "}" Then
                                            f3.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        End If
                                    Next
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 11 Then : CheckBox15.Checked = True
                                    Dim tmp4 As Short
                                    Dim tmp5 As Short = 0
                                    Dim tmp6 As Short = tmp3
                                    Dim tmpstr As String = Mid(mscstr, 1, tmp2 - 1)
                                    For tmp4 = tmp3 To Len(tmpstr) Step 1
                                        If Mid(tmpstr, tmp4, 1) = "[" Then
                                            a4.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "d" Then
                                            b4.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "]" Then
                                            c4.Text = "d" + Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "{" Then
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "," Then
                                            If tmp5 = 0 Then
                                                d4.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                                tmp6 = +tmp4 + 1
                                                tmp5 += 1
                                            Else
                                                e4.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                                tmp6 = +tmp4 + 1
                                            End If
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "}" Then
                                            f4.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        End If
                                    Next
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 14 Then : CheckBox16.Checked = True
                                    Dim tmp4 As Short
                                    Dim tmp5 As Short = 0
                                    Dim tmp6 As Short = tmp3
                                    Dim tmpstr As String = Mid(mscstr, 1, tmp2 - 1)
                                    For tmp4 = tmp3 To Len(tmpstr) Step 1
                                        If Mid(tmpstr, tmp4, 1) = "[" Then
                                            a5.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "d" Then
                                            b5.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "]" Then
                                            c5.Text = "d" + Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "{" Then
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "," Then
                                            If tmp5 = 0 Then
                                                d5.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                                tmp6 = +tmp4 + 1
                                                tmp5 += 1
                                            Else
                                                e5.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                                tmp6 = +tmp4 + 1
                                            End If
                                            tmp6 = +tmp4 + 1
                                        ElseIf Mid(tmpstr, tmp4, 1) = "}" Then
                                            f5.Text = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        End If
                                    Next
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                Else
                                    stepnum += 1
                                End If
                            End If
                        Next
                        Exit For
                    End If
                Next
                dt1change(0, System.EventArgs.Empty)
                dt2change(0, System.EventArgs.Empty)
                dt3change(0, System.EventArgs.Empty)
                dt4change(0, System.EventArgs.Empty)
                dt5change(0, System.EventArgs.Empty)
            Else
                CheckBox12.Checked = False
                CheckBox13.Checked = False
                CheckBox14.Checked = False
                CheckBox15.Checked = False
                CheckBox16.Checked = False
                dt1change(0, System.EventArgs.Empty)
                dt2change(0, System.EventArgs.Empty)
                dt3change(0, System.EventArgs.Empty)
                dt4change(0, System.EventArgs.Empty)
                dt5change(0, System.EventArgs.Empty)
            End If
            tmp0 = InStr(MobData, "ARMOR#" + npcnum + "(")
            If tmp0 > 0 Then : stepnum = 0 : CheckBox26.Checked = True : acchange(0, System.EventArgs.Empty)
                For tmp1 = InStr(MobData, "ARMOR#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        mscstr = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Mid(MobData, InStr(MobData, "ARMOR#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "ARMOR#" + npcnum + "(") - 7 - Len(npcnum)), "BashAC", ""), "SlashAC", ""), "PierceAC", ""), "FistAC", ""), "ExoticAC", ""), "[", ""), "]", "")
                        For tmp2 = 1 To Len(mscstr) + 1 Step 1
                            If Mid(mscstr + ",", tmp2, 1) = "," Then
                                If stepnum = 0 Then
                                    BashAC.Text = Mid(mscstr, 1, tmp2 - 1)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 1 Then
                                    SlashAC.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 2 Then
                                    PierceAC.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 3 Then
                                    FistAC.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 4 Then
                                    ExoticAC.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                End If
                            End If
                        Next
                        Exit For
                    End If
                Next
            Else
                CheckBox26.Checked = False : acchange(0, System.EventArgs.Empty)
            End If
            tmp0 = InStr(MobData, "ARMST#" + npcnum + "(")
            If tmp0 > 0 Then : stepnum = 0 : CheckBox27.Checked = True : AttackExpertise(0, System.EventArgs.Empty)
                For tmp1 = InStr(MobData, "ARMST#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        mscstr = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Mid(MobData, InStr(MobData, "ARMST#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "ARMST#" + npcnum + "(") - 7 - Len(npcnum)), "BashStr", ""), "SlashStr", ""), "PierceStr", ""), "FistStr", ""), "ExoticStr", ""), "[", ""), "]", "")
                        For tmp2 = 1 To Len(mscstr) + 1 Step 1
                            If Mid(mscstr + ",", tmp2, 1) = "," Then
                                If stepnum = 0 Then
                                    BashStr.Text = Mid(mscstr, 1, tmp2 - 1)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 1 Then
                                    SlashStr.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 2 Then
                                    PierceStr.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 3 Then
                                    FistStr.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 4 Then
                                    ExoticStr.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                End If
                            End If
                        Next
                        Exit For
                    End If
                Next
            Else
                CheckBox27.Checked = False : AttackExpertise(0, System.EventArgs.Empty)
            End If
            tmp0 = InStr(MobData, "ELERE#" + npcnum + "(")
            If tmp0 > 0 Then : stepnum = 0 : CheckBox28.Checked = True : elementalres(0, System.EventArgs.Empty)
                For tmp1 = InStr(MobData, "ELERE#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        mscstr = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Mid(MobData, InStr(MobData, "ELERE#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "ELERE#" + npcnum + "(") - 7 - Len(npcnum)), "FireRes", ""), "WaterRes", ""), "AirRes", ""), "EarthRes", ""), "SpiritRes", ""), "[", ""), "]", "")
                        For tmp2 = 1 To Len(mscstr) + 1 Step 1
                            If Mid(mscstr + ",", tmp2, 1) = "," Then
                                If stepnum = 0 Then
                                    FireRes.Text = Mid(mscstr, 1, tmp2 - 1)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 1 Then
                                    WaterRes.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 2 Then
                                    AirRes.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 3 Then
                                    EarthRes.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 4 Then
                                    SpiritRes.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                End If
                            End If
                        Next
                        Exit For
                    End If
                Next
            Else
                CheckBox28.Checked = False : elementalres(0, System.EventArgs.Empty)
            End If
            tmp0 = InStr(MobData, "ELEAM#" + npcnum + "(")
            If tmp0 > 0 Then : stepnum = 0 : CheckBox29.Checked = True : elementalampchange(0, System.EventArgs.Empty)
                For tmp1 = InStr(MobData, "ELEAM#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        mscstr = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Mid(MobData, InStr(MobData, "ELEAM#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "ELEAM#" + npcnum + "(") - 7 - Len(npcnum)), "FireAmp", ""), "WaterAmp", ""), "AirAmp", ""), "EarthAmp", ""), "SpiritAmp", ""), "[", ""), "]", "")
                        For tmp2 = 1 To Len(mscstr) + 1 Step 1
                            If Mid(mscstr + ",", tmp2, 1) = "," Then
                                If stepnum = 0 Then
                                    FireAmp.Text = Mid(mscstr, 1, tmp2 - 1)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 1 Then
                                    WaterAmp.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 2 Then
                                    AirAmp.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 3 Then
                                    EarthAmp.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 4 Then
                                    SpiritAmp.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                End If
                            End If
                        Next
                        Exit For
                    End If
                Next
            Else
                CheckBox29.Checked = False : elementalampchange(0, System.EventArgs.Empty)
            End If
            tmp0 = InStr(MobData, "SELRE#" + npcnum + "(")
            If tmp0 > 0 Then : stepnum = 0 : CheckBox30.Checked = True : subelementalreschange(0, System.EventArgs.Empty)
                For tmp1 = InStr(MobData, "SELRE#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        mscstr = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Mid(MobData, InStr(MobData, "SELRE#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "SELRE#" + npcnum + "(") - 7 - Len(npcnum)), "SubFireRes", ""), "SubWaterRes", ""), "SubAirRes", ""), "SubEarthRes", ""), "SubSpiritRes", ""), "[", ""), "]", "")
                        For tmp2 = 1 To Len(mscstr) + 1 Step 1
                            If Mid(mscstr + ",", tmp2, 1) = "," Then
                                If stepnum = 0 Then
                                    SubFireRes.Text = Mid(mscstr, 1, tmp2 - 1)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 1 Then
                                    SubWaterRes.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 2 Then
                                    SubAirRes.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 3 Then
                                    SubEarthRes.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 4 Then
                                    SubSpiritRes.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                End If
                            End If
                        Next
                        Exit For
                    End If
                Next
            Else
                CheckBox30.Checked = False : subelementalreschange(0, System.EventArgs.Empty)
            End If
            tmp0 = InStr(MobData, "SELAM#" + npcnum + "(")
            If tmp0 > 0 Then : stepnum = 0 : CheckBox31.Checked = True : subelementalampchange(0, System.EventArgs.Empty)
                For tmp1 = InStr(MobData, "SELAM#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        mscstr = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Mid(MobData, InStr(MobData, "SELAM#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "SELAM#" + npcnum + "(") - 7 - Len(npcnum)), "SubFireAmp", ""), "SubWaterAmp", ""), "SubAirAmp", ""), "SubEarthAmp", ""), "SubSpiritAmp", ""), "[", ""), "]", "")
                        For tmp2 = 1 To Len(mscstr) + 1 Step 1
                            If Mid(mscstr + ",", tmp2, 1) = "," Then
                                If stepnum = 0 Then
                                    SubFireAmp.Text = Mid(mscstr, 1, tmp2 - 1)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 1 Then
                                    SubWaterAmp.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 2 Then
                                    SubAirAmp.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 3 Then
                                    SubEarthAmp.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 4 Then
                                    SubSpiritAmp.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                End If
                            End If
                        Next
                        Exit For
                    End If
                Next
            Else
                CheckBox31.Checked = False : subelementalampchange(0, System.EventArgs.Empty)
            End If
            tmp0 = InStr(MobData, "MOUNT#" + npcnum + "(")
            If tmp0 > 0 Then : stepnum = 0 : CheckBox1.Checked = True : mountchange(0, System.EventArgs.Empty)
                For tmp1 = InStr(MobData, "MOUNT#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        mscstr = Mid(MobData, InStr(MobData, "MOUNT#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "MOUNT#" + npcnum + "(") - 7 - Len(npcnum))
                        For tmp2 = 1 To Len(mscstr) + 1 Step 1
                            If Mid(mscstr + ",", tmp2, 1) = "," Then
                                If stepnum = 0 Then
                                    mountbag.Text = Mid(mscstr, 1, tmp2 - 1)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 1 Then
                                    mountspeed.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 2 Then
                                    mountlvlreq.Text = Mid(mscstr, tmp3, tmp2 - tmp3)
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                ElseIf stepnum = 3 Then
                                    Dim tmp4 As Short
                                    Dim tmp5 As Short
                                    Dim tmpstr2 As String = Mid(mscstr, tmp3, tmp2 - 3)
                                    For tmp4 = 1 To Len(tmpstr2) Step 1
                                        If Mid(tmpstr2, tmp4, 1) = "S" Then
                                            MountCost1.Text = Mid(tmpstr2, 1, tmp4 - 1)
                                            tmp5 = tmp4 + 2
                                        ElseIf Mid(tmpstr2, tmp4, 1) = "D" Then
                                            MountCost2.Text = Mid(tmpstr2, tmp5, tmp4 - tmp5)
                                            tmp5 = tmp4 + 2
                                        ElseIf Mid(tmpstr2, tmp4, 1) = "V" Then
                                            MountCost3.Text = Mid(tmpstr2, tmp5, tmp4 - tmp5)
                                            Exit For
                                        End If
                                    Next
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                End If
                            End If
                        Next
                        Exit For
                    End If
                Next
            Else
                CheckBox1.Checked = False : mountchange(0, System.EventArgs.Empty)
            End If
            CheckBox25.Checked = False
            tmp0 = InStr(MobData, "HITPO#" + npcnum + "(")
            If tmp0 > 0 Then : CheckBox25.Checked = True
                For tmp1 = InStr(MobData, "HITPO#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        hp.Text = Mid(MobData, InStr(MobData, "HITPO#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "HITPO#" + npcnum + "(") - 7 - Len(npcnum))
                        Exit For
                    End If
                Next
            End If
            tmp0 = InStr(MobData, "WILLP#" + npcnum + "(")
            If tmp0 > 0 Then : CheckBox25.Checked = True
                For tmp1 = InStr(MobData, "WILLP#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        wp.Text = Mid(MobData, InStr(MobData, "WILLP#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "WILLP#" + npcnum + "(") - 7 - Len(npcnum))
                        Exit For
                    End If
                Next
            End If
            tmp0 = InStr(MobData, "STAMP#" + npcnum + "(")
            If tmp0 > 0 Then : CheckBox25.Checked = True
                For tmp1 = InStr(MobData, "STAMP#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        sp.Text = Mid(MobData, InStr(MobData, "STAMP#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "STAMP#" + npcnum + "(") - 7 - Len(npcnum))
                        Exit For
                    End If
                Next
            End If
            statchange(0, System.EventArgs.Empty)
            tmp0 = InStr(MobData, "LEVEL#" + npcnum + "(")
            If tmp0 > 0 Then : CheckBox32.Checked = True
                For tmp1 = InStr(MobData, "LEVEL#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        level.Text = Mid(MobData, InStr(MobData, "LEVEL#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "LEVEL#" + npcnum + "(") - 7 - Len(npcnum))
                        Exit For
                    End If
                Next
            Else
                CheckBox32.Checked = False
            End If
            tmp0 = InStr(MobData, "WEIGH#" + npcnum + "(")
            If tmp0 > 0 Then
                For tmp1 = InStr(MobData, "WEIGH#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        MobileWeight.Text = Mid(MobData, InStr(MobData, "WEIGH#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "WEIGH#" + npcnum + "(") - 7 - Len(npcnum))
                        Exit For
                    End If
                Next
            Else
                MobileWeight.Text = "0"
            End If
            tmp0 = InStr(MobData, "ENDMB#" + npcnum + "(")
            If tmp0 > 0 Then : SND("/GLoading comments...")
                For tmp1 = InStr(MobData, "ENDMB#" + npcnum + "(") To Len(MobData) Step 1
                    If Mid(MobData, tmp1, 1) = ")" Then
                        comments.Text = Replace(Mid(MobData, InStr(MobData, "ENDMB#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "ENDMB#" + npcnum + "(") - 7 - Len(npcnum)), "%p45", "")
                        Exit For
                    End If
                Next
            End If
            SND("/GMobile loaded.")
        Else
            MobShort.Text = "Insert Short String Here"
            MobName.Text = "Insert Real Name Here"
            MobArchetype.Text = "0. Standard Archetype"
            CheckBox32.Checked = False : level.Enabled = False
            level.Text = "Level 1"
            CheckBox25.Checked = False : hp.Enabled = False : wp.Enabled = False : sp.Enabled = False
            hp.Text = "100" : wp.Text = "100" : sp.Text = "100"
            MobRace.Enabled = True : MobRace.Text = "00. Human"
            Sentient.Checked = True
            MobCreature.Enabled = False : MobCreature.Text = "0000. Centaur"
            LookD.Text = ""
            SCRIT.Items.Clear() : SCRIT.Text = ""
            VIRID.Enabled = False : VIRID.Text = ""
            MobHatred_Race.Enabled = False : MobHatred_Race.Text = "15. No race hatred" : CheckBox17.Checked = False
            MobType.Text = "0. Regular Mobile"
            MobHatred_Class.Enabled = False : MobHatred_Class.Text = "00. No class hatred" : CheckBox18.Checked = False
            MobClass.Text = "00. No defined class (Unarmed combat only)"
            MobHatred_Sex.Enabled = False : MobHatred_Sex.Text = "0. No sex hatred" : CheckBox19.Checked = False
            MobClassPreset.Text = "0. No Class-Defined Combat Tactics Preset"
            MobTemperment.Text = "0. Passive Temperment" : MobTemperment.Enabled = False : CheckBox33.Checked = False
            CheckBox1.Checked = False : mountbag.Enabled = False : mountspeed.Enabled = False : MountCost1.Enabled = False : MountCost2.Enabled = False : MountCost3.Enabled = False : mountlvlreq.Enabled = False
            mountbag.Text = "None" : mountspeed.Text = "Speed 1" : mountlvlreq.Text = "lvlreq0"
            CheckBox12.Checked = False : a1.Enabled = False : a2.Enabled = False : a3.Enabled = False : a4.Enabled = False : a5.Enabled = False
            CheckBox13.Checked = False : b1.Enabled = False : b2.Enabled = False : b3.Enabled = False : b4.Enabled = False : b5.Enabled = False
            CheckBox14.Checked = False : c1.Enabled = False : c2.Enabled = False : c3.Enabled = False : c4.Enabled = False : c5.Enabled = False
            CheckBox15.Checked = False : e1.Enabled = False : e2.Enabled = False : e3.Enabled = False : e4.Enabled = False : e5.Enabled = False
            CheckBox16.Checked = False : d1.Enabled = False : d2.Enabled = False : d3.Enabled = False : d4.Enabled = False : d5.Enabled = False
            f1.Enabled = False : f2.Enabled = False : f3.Enabled = False : f4.Enabled = False : f5.Enabled = False
            a1.Text = "DamageName1" : a2.Text = "DamageName2" : a3.Text = "DamageName3" : a4.Text = "DamageName4" : a5.Text = "DamageName5"
            b1.Text = "1" : b2.Text = "1" : b3.Text = "1" : b4.Text = "1" : b5.Text = "1"
            c1.Text = "d2" : c2.Text = "d2" : c3.Text = "d2" : c4.Text = "d2" : c5.Text = "d2"
            d1.Text = "Bash" : d2.Text = "Bash" : d3.Text = "Bash" : d4.Text = "Bash" : d5.Text = "Bash"
            e1.Text = "" : e2.Text = "" : e3.Text = "" : e4.Text = "" : e5.Text = ""
            f1.Text = "x2 Crit Value" : f2.Text = "x2 Crit Value" : f3.Text = "x2 Crit Value" : f4.Text = "x2 Crit Value" : f5.Text = "x2 Crit Value"
            CheckBox26.Checked = False : CheckBox27.Checked = False : CheckBox28.Checked = False : CheckBox29.Checked = False : CheckBox30.Checked = False : CheckBox31.Checked = False
            BashAC.Text = "" : BashAC.Enabled = False
            SlashAC.Text = "" : SlashAC.Enabled = False
            PierceAC.Text = "" : PierceAC.Enabled = False
            FistAC.Text = "" : FistAC.Enabled = False
            ExoticAC.Text = "" : ExoticAC.Enabled = False
            BashStr.Text = "" : BashStr.Enabled = False
            SlashStr.Text = "" : SlashStr.Enabled = False
            PierceStr.Text = "" : PierceStr.Enabled = False
            FistStr.Text = "" : FistStr.Enabled = False
            ExoticStr.Text = "" : ExoticStr.Enabled = False
            FireRes.Text = "" : FireRes.Enabled = False
            WaterRes.Text = "" : WaterRes.Enabled = False
            EarthRes.Text = "" : EarthRes.Enabled = False
            AirRes.Text = "" : AirRes.Enabled = False
            SpiritRes.Text = "" : SpiritRes.Enabled = False
            FireAmp.Text = "" : FireAmp.Enabled = False
            WaterAmp.Text = "" : WaterAmp.Enabled = False
            AirAmp.Text = "" : AirAmp.Enabled = False
            SpiritAmp.Text = "" : SpiritAmp.Enabled = False
            SubFireRes.Text = "" : SubFireRes.Enabled = False
            SubWaterRes.Text = "" : SubWaterRes.Enabled = False
            SubAirRes.Text = "" : SubAirRes.Enabled = False
            SubEarthRes.Text = "" : SubEarthRes.Enabled = False
            SubSpiritRes.Text = "" : SubSpiritRes.Enabled = False
            SubFireAmp.Text = "" : SubFireAmp.Enabled = False
            SubWaterAmp.Text = "" : SubWaterAmp.Enabled = False
            SubAirAmp.Text = "" : SubAirAmp.Enabled = False
            SubEarthAmp.Text = "" : SubEarthAmp.Enabled = False
            SubSpiritAmp.Text = "" : SubSpiritAmp.Enabled = False
            StaticItem1change.Checked = False : StaticItem2change.Checked = False : StaticItem3change.Checked = False : StaticItem4change.Checked = False
            StaticItem5change.Checked = False : DynamicItem1changed.Checked = False : DynamicItem2changed.Checked = False : DynamicItem3changed.Checked = False
            DynamicItem4changed.Checked = False : DynamicItem5changed.Checked = False
            StaticItem1.Enabled = False : StaticItem1.Text = "0. No Defined Item"
            StaticItem2.Enabled = False : StaticItem2.Text = "0. No Defined Item"
            StaticItem3.Enabled = False : StaticItem3.Text = "0. No Defined Item"
            StaticItem4.Enabled = False : StaticItem4.Text = "0. No Defined Item"
            StaticItem5.Enabled = False : StaticItem5.Text = "0. No Defined Item"
            DynamicItem1.Enabled = False : DynamicItem1.Text = "0. No Dynamic Drop Type"
            DynamicItem2.Enabled = False : DynamicItem2.Text = "0. No Dynamic Drop Type"
            DynamicItem3.Enabled = False : DynamicItem3.Text = "0. No Dynamic Drop Type"
            DynamicItem4.Enabled = False : DynamicItem4.Text = "0. No Dynamic Drop Type"
            DynamicItem5.Enabled = False : DynamicItem5.Text = "0. No Dynamic Drop Type"
            OpenScriptEditor.Enabled = False
            comments.Text = ""
            Path1.Checked = True
            SND("/GCleared template.")
        End If
    End Sub
    Private Sub scriptload(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SCRIT.DropDown
        OpenScriptEditor.Enabled = True
        SCRIT.Items.Clear()
        Dim int2 As Integer
        Dim int3 As Integer
        Dim CurNum As Integer = 1
        Dim str1 As String = Replace(Str(CurNum), " ", "")
        ScriptData = GetFileContents(Debugger.DirScripts, sErr)
        Dim astr As String = ""
        Dim aint As Integer
        Dim mshort As String = ""
        For aint = InStr(ScriptData, "TOTAL#") To Len(ScriptData) Step 1
            If Mid(ScriptData, aint, 1) = "(" Then
                astr = LTrim(Str(Val(Mid(ScriptData, InStr(ScriptData, "TOTAL#") + 6, aint - InStr(ScriptData, "TOTAL#") - 6))))
                ScriptData = Replace(ScriptData, Mid(ScriptData, InStr(ScriptData, "TOTAL#"), 8 + Len(astr) * 2), "TOTAL#" + astr + "(" + astr + ")")
                Exit For
            End If
        Next
        For int2 = 1 To Val(astr) Step 1
            For int3 = InStr(ScriptData, "INTRO#" + LTrim(Str(int2))) To Len(ScriptData) Step 1
                If Mid(ScriptData, int3, 1) = ")" Then
                    SCRIT.Items.Add(LTrim(Str(int2)) + ". " + Mid(ScriptData, InStr(ScriptData, "INTRO#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int3 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(ScriptData, "INTRO#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2)))))
                    Exit For
                End If
            Next
        Next
    End Sub
    Private Sub editscriptform(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenScriptEditor.Click
        Dim tmp1 As Integer
        Dim tmpstr As String = ""
        If SCRIT.Text <> "" Then
            For tmp1 = 1 To Len(SCRIT.Text) Step 1
                If Mid(SCRIT.Text, tmp1, 1) = "." Then
                    tmpstr = Mid(SCRIT.Text, 1, tmp1 - 1)
                    SND("/GLoading script number " + tmpstr)
                    ScriptEditor.LoadScript(tmpstr)
                    Exit For
                End If
            Next
        Else
            SND("/RERROR: No SCRIT number inputed")
        End If
    End Sub
    Private Sub loaditems(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StaticItem1.DropDown
        StaticItem1.Items.Clear()
        StaticItem1.Items.Add("0. No Defined Item")
        Dim int2 As Integer
        Dim int3 As Integer
        Dim int4 As Integer
        Dim CurNum As Integer = 1
        Dim str1 As String = Replace(Str(CurNum), " ", "")
        ItemData = GetFileContents(Debugger.DirItems, sErr)
        Dim astr As String = ""
        Dim aint As Integer
        Dim itemn As String = ""
        For aint = InStr(ItemData, "TOTAL#") To Len(ItemData) Step 1
            If Mid(ItemData, aint, 1) = "(" Then
                astr = LTrim(Str(Val(Mid(ItemData, InStr(ItemData, "TOTAL#") + 6, aint - InStr(ItemData, "TOTAL#") - 6))))
                ItemData = Replace(ItemData, Mid(ItemData, InStr(ItemData, "TOTAL#"), 8 + Len(astr) * 2), "TOTAL#" + astr + "(" + astr + ")")
                Exit For
            End If
        Next
        For int2 = 1 To Val(astr) Step 1
            For int3 = InStr(ItemData, "SHORT#" + LTrim(Str(int2))) To Len(ItemData) Step 1
                If Mid(ItemData, int3, 1) = ")" Then
                    For int4 = InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) To Len(ItemData) Step 1
                        If Mid(ItemData, int4, 1) = ")" Then
                            itemn = Mid(ItemData, InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int4 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))))
                            Exit For
                        End If
                    Next
                    StaticItem1.Items.Add(LTrim(Str(int2)) + ". " + Mid(ItemData, InStr(ItemData, "SHORT#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int3 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(ItemData, "SHORT#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2)))) + " (" + itemn + ")")
                    Exit For
                End If
            Next
        Next
        StaticItem2.Items.Clear()
        StaticItem2.Items.Add("0. No Defined Item")
        int2 = 0
        int3 = 0
        int4 = 0
        CurNum = 1
        str1 = Replace(Str(CurNum), " ", "")
        astr = ""
        aint = 0
        itemn = ""
        For aint = InStr(ItemData, "TOTAL#") To Len(ItemData) Step 1
            If Mid(ItemData, aint, 1) = "(" Then
                astr = LTrim(Str(Val(Mid(ItemData, InStr(ItemData, "TOTAL#") + 6, aint - InStr(ItemData, "TOTAL#") - 6))))
                ItemData = Replace(ItemData, Mid(ItemData, InStr(ItemData, "TOTAL#"), 8 + Len(astr) * 2), "TOTAL#" + astr + "(" + astr + ")")
                Exit For
            End If
        Next
        For int2 = 1 To Val(astr) Step 1
            For int3 = InStr(ItemData, "SHORT#" + LTrim(Str(int2))) To Len(ItemData) Step 1
                If Mid(ItemData, int3, 1) = ")" Then
                    For int4 = InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) To Len(ItemData) Step 1
                        If Mid(ItemData, int4, 1) = ")" Then
                            itemn = Mid(ItemData, InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int4 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))))
                            Exit For
                        End If
                    Next
                    StaticItem2.Items.Add(LTrim(Str(int2)) + ". " + Mid(ItemData, InStr(ItemData, "SHORT#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int3 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(ItemData, "SHORT#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2)))) + " (" + itemn + ")")
                    Exit For
                End If
            Next
        Next
        StaticItem3.Items.Clear()
        StaticItem3.Items.Add("0. No Defined Item")
        int2 = 0
        int3 = 0
        int4 = 0
        CurNum = 1
        str1 = Replace(Str(CurNum), " ", "")
        astr = ""
        aint = 0
        itemn = ""
        For aint = InStr(ItemData, "TOTAL#") To Len(ItemData) Step 1
            If Mid(ItemData, aint, 1) = "(" Then
                astr = LTrim(Str(Val(Mid(ItemData, InStr(ItemData, "TOTAL#") + 6, aint - InStr(ItemData, "TOTAL#") - 6))))
                ItemData = Replace(ItemData, Mid(ItemData, InStr(ItemData, "TOTAL#"), 8 + Len(astr) * 2), "TOTAL#" + astr + "(" + astr + ")")
                Exit For
            End If
        Next
        For int2 = 1 To Val(astr) Step 1
            For int3 = InStr(ItemData, "SHORT#" + LTrim(Str(int2))) To Len(ItemData) Step 1
                If Mid(ItemData, int3, 1) = ")" Then
                    For int4 = InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) To Len(ItemData) Step 1
                        If Mid(ItemData, int4, 1) = ")" Then
                            itemn = Mid(ItemData, InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int4 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))))
                            Exit For
                        End If
                    Next
                    StaticItem3.Items.Add(LTrim(Str(int2)) + ". " + Mid(ItemData, InStr(ItemData, "SHORT#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int3 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(ItemData, "SHORT#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2)))) + " (" + itemn + ")")
                    Exit For
                End If
            Next
        Next
        StaticItem4.Items.Clear()
        StaticItem4.Items.Add("0. No Defined Item")
        int2 = 0
        int3 = 0
        int4 = 0
        CurNum = 1
        str1 = Replace(Str(CurNum), " ", "")
        astr = ""
        aint = 0
        itemn = ""
        For aint = InStr(ItemData, "TOTAL#") To Len(ItemData) Step 1
            If Mid(ItemData, aint, 1) = "(" Then
                astr = LTrim(Str(Val(Mid(ItemData, InStr(ItemData, "TOTAL#") + 6, aint - InStr(ItemData, "TOTAL#") - 6))))
                ItemData = Replace(ItemData, Mid(ItemData, InStr(ItemData, "TOTAL#"), 8 + Len(astr) * 2), "TOTAL#" + astr + "(" + astr + ")")
                Exit For
            End If
        Next
        For int2 = 1 To Val(astr) Step 1
            For int3 = InStr(ItemData, "SHORT#" + LTrim(Str(int2))) To Len(ItemData) Step 1
                If Mid(ItemData, int3, 1) = ")" Then
                    For int4 = InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) To Len(ItemData) Step 1
                        If Mid(ItemData, int4, 1) = ")" Then
                            itemn = Mid(ItemData, InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int4 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))))
                            Exit For
                        End If
                    Next
                    StaticItem4.Items.Add(LTrim(Str(int2)) + ". " + Mid(ItemData, InStr(ItemData, "SHORT#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int3 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(ItemData, "SHORT#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2)))) + " (" + itemn + ")")
                    Exit For
                End If
            Next
        Next
        StaticItem5.Items.Clear()
        StaticItem5.Items.Add("0. No Defined Item")
        int2 = 0
        int3 = 0
        int4 = 0
        CurNum = 1
        str1 = Replace(Str(CurNum), " ", "")
        astr = ""
        aint = 0
        itemn = ""
        For aint = InStr(ItemData, "TOTAL#") To Len(ItemData) Step 1
            If Mid(ItemData, aint, 1) = "(" Then
                astr = LTrim(Str(Val(Mid(ItemData, InStr(ItemData, "TOTAL#") + 6, aint - InStr(ItemData, "TOTAL#") - 6))))
                ItemData = Replace(ItemData, Mid(ItemData, InStr(ItemData, "TOTAL#"), 8 + Len(astr) * 2), "TOTAL#" + astr + "(" + astr + ")")
                Exit For
            End If
        Next
        For int2 = 1 To Val(astr) Step 1
            For int3 = InStr(ItemData, "SHORT#" + LTrim(Str(int2))) To Len(ItemData) Step 1
                If Mid(ItemData, int3, 1) = ")" Then
                    For int4 = InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) To Len(ItemData) Step 1
                        If Mid(ItemData, int4, 1) = ")" Then
                            itemn = Mid(ItemData, InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int4 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(ItemData, "ITEMN#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))))
                            Exit For
                        End If
                    Next
                    StaticItem5.Items.Add(LTrim(Str(int2)) + ". " + Mid(ItemData, InStr(ItemData, "SHORT#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2))), int3 - 14 - Len(LTrim(Str(int2))) * 2 - InStr(ItemData, "SHORT#" + LTrim(Str(int2))) + 7 + Len(LTrim(Str(int2)))) + " (" + itemn + ")")
                    Exit For
                End If
            Next
        Next
    End Sub
    Private Sub CheckKeys(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = Keys.Escape Then Me.Close()
    End Sub
    Private Sub ClearTemplate(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        MobShort.Text = "Insert Short String Here"
        MobName.Text = "Insert Real Name Here"
        MobArchetype.Text = "0. Standard Archetype"
        CheckBox32.Checked = False : level.Enabled = False
        level.Text = "Level 1"
        CheckBox25.Checked = False : hp.Enabled = False : wp.Enabled = False : sp.Enabled = False
        hp.Text = "100" : wp.Text = "100" : sp.Text = "100"
        MobRace.Enabled = True : MobRace.Text = "00. Human"
        Sentient.Checked = True
        MobCreature.Enabled = False : MobCreature.Text = "0000. Centaur"
        LookD.Text = ""
        SCRIT.Items.Clear() : SCRIT.Text = ""
        VIRID.Enabled = False : VIRID.Text = ""
        MobHatred_Race.Enabled = False : MobHatred_Race.Text = "15. No race hatred" : CheckBox17.Checked = False
        MobType.Text = "0. Regular Mobile"
        MobHatred_Class.Enabled = False : MobHatred_Class.Text = "00. No class hatred" : CheckBox18.Checked = False
        MobClass.Text = "00. No defined class (Unarmed combat only)"
        MobHatred_Sex.Enabled = False : MobHatred_Sex.Text = "0. No sex hatred" : CheckBox19.Checked = False
        MobClassPreset.Text = "0. No Class-Defined Combat Tactics Preset"
        MobTemperment.Text = "0. Passive Temperment" : MobTemperment.Enabled = False : CheckBox33.Checked = False
        CheckBox1.Checked = False : mountbag.Enabled = False : mountspeed.Enabled = False : MountCost1.Enabled = False : MountCost2.Enabled = False : MountCost3.Enabled = False : mountlvlreq.Enabled = False
        mountbag.Text = "None" : mountspeed.Text = "Speed 1" : mountlvlreq.Text = "lvlreq0"
        CheckBox12.Checked = False : a1.Enabled = False : a2.Enabled = False : a3.Enabled = False : a4.Enabled = False : a5.Enabled = False
        CheckBox13.Checked = False : b1.Enabled = False : b2.Enabled = False : b3.Enabled = False : b4.Enabled = False : b5.Enabled = False
        CheckBox14.Checked = False : c1.Enabled = False : c2.Enabled = False : c3.Enabled = False : c4.Enabled = False : c5.Enabled = False
        CheckBox15.Checked = False : e1.Enabled = False : e2.Enabled = False : e3.Enabled = False : e4.Enabled = False : e5.Enabled = False
        CheckBox16.Checked = False : d1.Enabled = False : d2.Enabled = False : d3.Enabled = False : d4.Enabled = False : d5.Enabled = False
        f1.Enabled = False : f2.Enabled = False : f3.Enabled = False : f4.Enabled = False : f5.Enabled = False
        a1.Text = "DamageName1" : a2.Text = "DamageName2" : a3.Text = "DamageName3" : a4.Text = "DamageName4" : a5.Text = "DamageName5"
        b1.Text = "1" : b2.Text = "1" : b3.Text = "1" : b4.Text = "1" : b5.Text = "1"
        c1.Text = "d2" : c2.Text = "d2" : c3.Text = "d2" : c4.Text = "d2" : c5.Text = "d2"
        d1.Text = "Bash" : d2.Text = "Bash" : d3.Text = "Bash" : d4.Text = "Bash" : d5.Text = "Bash"
        e1.Text = "" : e2.Text = "" : e3.Text = "" : e4.Text = "" : e5.Text = ""
        f1.Text = "x2 Crit Value" : f2.Text = "x2 Crit Value" : f3.Text = "x2 Crit Value" : f4.Text = "x2 Crit Value" : f5.Text = "x2 Crit Value"
        CheckBox26.Checked = False : CheckBox27.Checked = False : CheckBox28.Checked = False : CheckBox29.Checked = False : CheckBox30.Checked = False : CheckBox31.Checked = False
        BashAC.Text = "" : BashAC.Enabled = False
        SlashAC.Text = "" : SlashAC.Enabled = False
        PierceAC.Text = "" : PierceAC.Enabled = False
        FistAC.Text = "" : FistAC.Enabled = False
        ExoticAC.Text = "" : ExoticAC.Enabled = False
        BashStr.Text = "" : BashStr.Enabled = False
        SlashStr.Text = "" : SlashStr.Enabled = False
        PierceStr.Text = "" : PierceStr.Enabled = False
        FistStr.Text = "" : FistStr.Enabled = False
        ExoticStr.Text = "" : ExoticStr.Enabled = False
        FireRes.Text = "" : FireRes.Enabled = False
        WaterRes.Text = "" : WaterRes.Enabled = False
        EarthRes.Text = "" : EarthRes.Enabled = False
        AirRes.Text = "" : AirRes.Enabled = False
        SpiritRes.Text = "" : SpiritRes.Enabled = False
        FireAmp.Text = "" : FireAmp.Enabled = False
        WaterAmp.Text = "" : WaterAmp.Enabled = False
        AirAmp.Text = "" : AirAmp.Enabled = False
        SpiritAmp.Text = "" : SpiritAmp.Enabled = False
        SubFireRes.Text = "" : SubFireRes.Enabled = False
        SubWaterRes.Text = "" : SubWaterRes.Enabled = False
        SubAirRes.Text = "" : SubAirRes.Enabled = False
        SubEarthRes.Text = "" : SubEarthRes.Enabled = False
        SubSpiritRes.Text = "" : SubSpiritRes.Enabled = False
        SubFireAmp.Text = "" : SubFireAmp.Enabled = False
        SubWaterAmp.Text = "" : SubWaterAmp.Enabled = False
        SubAirAmp.Text = "" : SubAirAmp.Enabled = False
        SubEarthAmp.Text = "" : SubEarthAmp.Enabled = False
        SubSpiritAmp.Text = "" : SubSpiritAmp.Enabled = False
        StaticItem1change.Checked = False : StaticItem2change.Checked = False : StaticItem3change.Checked = False : StaticItem4change.Checked = False
        StaticItem5change.Checked = False : DynamicItem1changed.Checked = False : DynamicItem2changed.Checked = False : DynamicItem3changed.Checked = False
        DynamicItem4changed.Checked = False : DynamicItem5changed.Checked = False
        StaticItem1.Enabled = False : StaticItem1.Text = "0. No Defined Item"
        StaticItem2.Enabled = False : StaticItem2.Text = "0. No Defined Item"
        StaticItem3.Enabled = False : StaticItem3.Text = "0. No Defined Item"
        StaticItem4.Enabled = False : StaticItem4.Text = "0. No Defined Item"
        StaticItem5.Enabled = False : StaticItem5.Text = "0. No Defined Item"
        DynamicItem1.Enabled = False : DynamicItem1.Text = "0. No Dynamic Drop Type"
        DynamicItem2.Enabled = False : DynamicItem2.Text = "0. No Dynamic Drop Type"
        DynamicItem3.Enabled = False : DynamicItem3.Text = "0. No Dynamic Drop Type"
        DynamicItem4.Enabled = False : DynamicItem4.Text = "0. No Dynamic Drop Type"
        DynamicItem5.Enabled = False : DynamicItem5.Text = "0. No Dynamic Drop Type"
        OpenScriptEditor.Enabled = False
        comments.Text = ""
        Path1.Checked = True
        SND("/GCleared template.")
        SND("/YInitiated new mobile.")
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        MobData = GetFileContents(Debugger.DirMobs, sErr)
        Dim errornum As Short = 0
        Dim aint As Short
        Dim tmobdata As String = MobData
        Dim overwrite As Boolean = False
        Dim astr As String = ""
        If InStr(MobData, "TOTAL#") = 0 Then MobData = "TOTAL#0(0)"
        For aint = InStr(MobData, "TOTAL#") To Len(MobData) Step 1
            If Mid(MobData, aint, 1) = "(" Then
                astr = LTrim(Str(Val(Mid(MobData, InStr(MobData, "TOTAL#") + 6, aint - InStr(MobData, "TOTAL#") - 6)) + 1))
                Exit For
            End If
        Next
        For aint = InStr(MobData, "TOTAL#") To Len(MobData) Step 1
            If Mid(MobData, aint, 1) = "(" Then
                astr = LTrim(Str(Val(Mid(MobData, InStr(MobData, "TOTAL#") + 6, aint - InStr(MobData, "TOTAL#") - 6)) + 1))
                MobData = Replace(MobData, Mid(MobData, InStr(MobData, "TOTAL#"), 8 + Len(astr) * 2), "TOTAL#" + astr + "(" + astr + ")" + Chr(13))
                VIRID.Text = LTrim(RTrim(astr))
                Exit For
            End If
        Next
        SND("/GOld VNUM total: /Z" + LTrim(Str(Val(astr) - 1)) + " /Gchanged to match new mobile total.")
        SND("/GReserved VNUM: /Z" + VIRID.Text)
        SND("/wVIRID/z#" + VIRID.Text + "/W(/c" + VIRID.Text + "/W)")
        If VIRID.Text = "1" Then
            MobData += Mid(LTrim(Str(Val(astr) - 1)), Len(LTrim(Str(Val(astr) - 1))), 1) + ")" + Chr(13) + Chr(13) + "VIRID#" + VIRID.Text + "(" + VIRID.Text + ")"
        Else
            MobData += Chr(13) + Chr(13) + "VIRID#" + VIRID.Text + "(" + VIRID.Text + ")"
        End If
        astr = VIRID.Text
        SND("/wSHORT/z#" + astr + "/W(/c" + MobShort.Text + "/W)")
        MobData += Chr(13) + "SHORT#" + astr + "(" + MobShort.Text + ")"
        SND("/wMNAME/z#" + astr + "/W(/c" + MobName.Text + "/W)")
        MobData += Chr(13) + "MNAME#" + astr + "(" + MobName.Text + ")"
        If MobRace.Enabled = True Then
            SND("/wPARID/z#" + astr + "/W(/c" + Mid(MobArchetype.Text, 1, 1) + "," + Mid(MobRace.Text, 1, 2) + "," + Mid(MobHatred_Race.Text, 1, 2) + "," + Mid(MobHatred_Class.Text, 1, 2) + "," + Mid(MobHatred_Sex.Text, 1, 1) + "," + Mid(MobTemperment.Text, 1, 1) + "," + Mid(MobType.Text, 1, 1) + "," + Mid(MobClass.Text, 1, 2) + "," + Mid(MobClassPreset.Text, 1, 1) + "/W)")
            MobData += Chr(13) + "PARID#" + astr + "(" + Mid(MobArchetype.Text, 1, 1) + "," + Mid(MobRace.Text, 1, 2) + "," + Mid(MobHatred_Race.Text, 1, 2) + "," + Mid(MobHatred_Class.Text, 1, 2) + "," + Mid(MobHatred_Sex.Text, 1, 1) + "," + Mid(MobTemperment.Text, 1, 1) + "," + Mid(MobType.Text, 1, 1) + "," + Mid(MobClass.Text, 1, 2) + "," + Mid(MobClassPreset.Text, 1, 1) + ")"
        Else
            SND("/wPARID/z#" + astr + "/W(/c" + Mid(MobArchetype.Text, 1, 1) + "," + Mid(MobCreature.Text, 1, 4) + "," + Mid(MobHatred_Race.Text, 1, 2) + "," + Mid(MobHatred_Class.Text, 1, 2) + "," + Mid(MobHatred_Sex.Text, 1, 1) + "," + Mid(MobTemperment.Text, 1, 1) + "," + Mid(MobType.Text, 1, 1) + "," + Mid(MobClass.Text, 1, 2) + "," + Mid(MobClassPreset.Text, 1, 1) + "/W)")
            MobData += Chr(13) + "PARID#" + astr + "(" + Mid(MobArchetype.Text, 1, 1) + "," + Mid(MobCreature.Text, 1, 4) + "," + Mid(MobHatred_Race.Text, 1, 2) + "," + Mid(MobHatred_Class.Text, 1, 2) + "," + Mid(MobHatred_Sex.Text, 1, 1) + "," + Mid(MobTemperment.Text, 1, 1) + "," + Mid(MobType.Text, 1, 1) + "," + Mid(MobClass.Text, 1, 2) + "," + Mid(MobClassPreset.Text, 1, 1) + ")"
        End If
        If Path1.Checked = True Then
            SND("/wMOBMV/z#" + astr + "/W(/c0/W)")
            MobData += Chr(13) + "MOBMV#" + astr + "(0)"
        ElseIf Path2.Checked = True Then
            SND("/wMOVMV/z#" + astr + "/W(/c1,{" + PathingBox.Text + "})")
            MobData += Chr(13) + "MOBMV#" + astr + "(1,{" + PathingBox.Text + "})"
        ElseIf Path3.Checked = True Then
            SND("/wMOVMV/z#" + astr + "/W(/c2,{" + PathingBox.Text + "})")
            MobData += Chr(13) + "MOBMV#" + astr + "(2,{" + PathingBox.Text + "})"
        ElseIf Path4.Checked = True Then
            SND("/wMOVMV/z#" + astr + "/W(/c3,{" + PathingBox.Text + "})")
            MobData += Chr(13) + "MOBMV#" + astr + "(3,{" + PathingBox.Text + "})"
        End If
        If MerchantToggle.Checked = True Then
            Dim TheLine As String = "1,"
            If MerchantSellsInventory.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MerchantFavorsClass.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MerchantFavorsGender.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MerchantFavorsRace.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MWUnlimited.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "[" + MWSovern.Text + "S" + MWDover.Text + "D" + MWVern.Text + "V],"
            End If
            If MWB.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MWS.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MWV1.Checked = True Then
                TheLine += "0,"
            ElseIf MWV2.Checked = True Then
                TheLine += "1,"
            ElseIf MWV3.Checked = True Then
                TheLine += "2,"
            End If
            If MAB.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MAS.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MAV1.Checked = True Then
                TheLine += "0,"
            ElseIf MAV2.Checked = True Then
                TheLine += "1,"
            ElseIf MAV3.Checked = True Then
                TheLine += "2,"
            End If
            If MMB.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MMS.Checked = True Then
                TheLine += "1,"
            Else
                TheLine += "0,"
            End If
            If MMV1.Checked = True Then
                TheLine += "0"
            ElseIf MMV2.Checked = True Then
                TheLine += "1"
            ElseIf MMV3.Checked = True Then
                TheLine += "2"
            End If
            SND("/wMOBME/z#" + astr + "/W(/c" + TheLine + "/W)")
            MobData += Chr(13) + "MOBME#" + astr + "(" + TheLine + ")"
        Else
            SND("/wMOBME/z#" + astr + "/W(/c0/w)")
            MobData += Chr(13) + "MOBME#" + astr + "(0)"
        End If
        Dim statitem1 As String, statitem2 As String, statitem3 As String, statitem4 As String, statitem5 As String
        Dim dynamitem1 As String, dynamitem2 As String, dynamitem3 As String, dynamitem4 As String, dynamitem5 As String
        If DynamicItem1changed.Checked = True Then If Mid(DynamicItem1.Text, 1, 1) = "[" Then dynamitem1 = DynamicItem1.Text Else dynamitem1 = "0" Else dynamitem1 = "0"
        If DynamicItem2changed.Checked = True Then If Mid(DynamicItem2.Text, 1, 1) = "[" Then dynamitem2 = DynamicItem2.Text Else dynamitem2 = "0" Else dynamitem2 = "0"
        If DynamicItem3changed.Checked = True Then If Mid(DynamicItem3.Text, 1, 1) = "[" Then dynamitem3 = DynamicItem3.Text Else dynamitem3 = "0" Else dynamitem3 = "0"
        If DynamicItem4changed.Checked = True Then If Mid(DynamicItem4.Text, 1, 1) = "[" Then dynamitem4 = DynamicItem4.Text Else dynamitem4 = "0" Else dynamitem4 = "0"
        If DynamicItem5changed.Checked = True Then If Mid(DynamicItem5.Text, 1, 1) = "[" Then dynamitem5 = DynamicItem5.Text Else dynamitem5 = "0" Else dynamitem5 = "0"
        If StaticItem1change.Checked = True Then statitem1 = Mid(StaticItem1.Text, 1, 1) Else statitem1 = "0"
        If StaticItem2change.Checked = True Then statitem2 = Mid(StaticItem2.Text, 1, 1) Else statitem2 = "0"
        If StaticItem3change.Checked = True Then statitem3 = Mid(StaticItem3.Text, 1, 1) Else statitem3 = "0"
        If StaticItem4change.Checked = True Then statitem4 = Mid(StaticItem4.Text, 1, 1) Else statitem4 = "0"
        If StaticItem5change.Checked = True Then statitem5 = Mid(StaticItem5.Text, 1, 1) Else statitem5 = "0"
        SND("/wMOBTE/z#" + astr + "/W(/c" + statitem1 + "," + statitem2 + "," + statitem3 + "," + statitem4 + "," + statitem5 + "," + dynamitem1 + "," + dynamitem2 + "," + dynamitem3 + "," + dynamitem4 + "," + dynamitem5 + "/W)")
        MobData += Chr(13) + "MOBTE#" + astr + "(" + statitem1 + "," + statitem2 + "," + statitem3 + "," + statitem4 + "," + statitem5 + "," + dynamitem1 + "," + dynamitem2 + "," + dynamitem3 + "," + dynamitem4 + "," + dynamitem5 + ")"
        If LookD.Text <> "" Then
            SND("/wLOOKD/z#" + astr + "/W(/c" + LookD.Text + "/W)")
            MobData += Chr(13) + "LOOKD#" + astr + "(" + LookD.Text + ")"
        Else
            SND("/RERROR: LookD.txt returned 0")
            errornum += 1
        End If
        If SCRIT.Text <> "" Then
            SND("/wSCRIT/z#" + astr + "/W(/c" + SCRIT.Text + "/W)")
        Else
            SND("/RERROR: Scrit.txt returned 0")
            errornum += 1
        End If
        MobData += Chr(13) + "SCRIT#" + astr + "(" + SCRIT.Text + ")"
        Dim tempstr As String = ""
        If a1.Enabled = True Then tempstr = "/wDAMTY/z#" + astr + "/W(/c" + a1.Text + "[" + b1.Text + c1.Text + "]{" + d1.Text + "," + e1.Text + "," + f1.Text + "}"
        If a2.Enabled = True Then If a1.Enabled = True Then tempstr += "," + a2.Text + "[" + b2.Text + c2.Text + "]{" + d2.Text + "," + e2.Text + "," + f2.Text + "}" Else tempstr = "/wDAMTY/z#" + astr + "/W(/c" + a2.Text + "[" + b2.Text + c2.Text + "]{" + d2.Text + "," + e2.Text + "," + f2.Text + "}"
        If a3.Enabled = True Then If a1.Enabled = True Or a2.Enabled = True Then tempstr += "," + a3.Text + "[" + b3.Text + c3.Text + "]{" + d3.Text + "," + e3.Text + "," + f3.Text + "}" Else tempstr = "/wDAMTY/z#" + astr + "/W(/c" + a3.Text + "[" + b3.Text + c3.Text + "]{" + d3.Text + "," + e3.Text + "," + f3.Text + "}"
        If a4.Enabled = True Then If a1.Enabled = True Or a2.Enabled = True Or a3.Enabled = True Then tempstr += "," + a4.Text + "[" + b4.Text + c4.Text + "]{" + d4.Text + "," + e4.Text + "," + f4.Text + "}" Else tempstr = "/wDAMTY/z#" + astr + "/W(/c" + a4.Text + "[" + b4.Text + c4.Text + "]{" + d4.Text + "," + e4.Text + "," + f4.Text + "}"
        If a5.Enabled = True Then If a1.Enabled = True Or a2.Enabled = True Or a3.Enabled = True Or a4.Enabled = True Then tempstr += "," + a5.Text + "[" + b5.Text + c5.Text + "]{" + d5.Text + "," + e5.Text + "," + f5.Text + "}" Else tempstr = "/wDAMTY/z#" + astr + "/W(/c" + a5.Text + "[" + b5.Text + c5.Text + "]{" + d5.Text + "," + e5.Text + "," + f5.Text + "}"
        If tempstr <> "" Then : SND(tempstr + "/W)") : MobData += Chr(13) + Replace(Replace(Replace(Replace(tempstr, "/w", ""), "/W", ""), "/c", ""), "/z", "") + ")" : End If
        If BashAC.Enabled = True Then : SND("/wARMOR/z#" + astr + "/W(/cBashAC[" + BashAC.Text + "],SlashAC[" + SlashAC.Text + "],PierceAC[" + PierceAC.Text + "],FistAC[" + FistAC.Text + "],ExoticAC[" + ExoticAC.Text + "]/W)") : MobData += Chr(13) + "ARMOR#" + astr + "(BashAC[" + BashAC.Text + "],SlashAC[" + SlashAC.Text + "],PierceAC[" + PierceAC.Text + "],FistAC[" + FistAC.Text + "],ExoticAC[" + ExoticAC.Text + "])" : End If
        If BashStr.Enabled = True Then : SND("/wARMST/z#" + astr + "/W(/cBashStr[" + BashStr.Text + "],SlashStr[" + SlashStr.Text + "],PierceStr[" + PierceStr.Text + "],FistStr[" + FistStr.Text + "],ExoticStr[" + ExoticStr.Text + "]/W)") : MobData += Chr(13) + "ARMST#" + astr + "(BashStr[" + BashStr.Text + "],SlashStr[" + SlashStr.Text + "],PierceStr[" + PierceStr.Text + "],FistStr[" + FistStr.Text + "],ExoticStr[" + ExoticStr.Text + "])" : End If
        If FireRes.Enabled = True Then : SND("/wELERE/z#" + astr + "/W(/cFireRes[" + FireRes.Text + "],WaterRes[" + WaterRes.Text + "],AirRes[" + AirRes.Text + "],EarthRes[" + EarthRes.Text + "],SpiritRes[" + SpiritRes.Text + "]/W)") : MobData += Chr(13) + "ELERE#" + astr + "(FireRes[" + FireRes.Text + "],WaterRes[" + WaterRes.Text + "],AirRes[" + AirRes.Text + "],EarthRes[" + EarthRes.Text + "],SpiritRes[" + SpiritRes.Text + "])" : End If
        If FireAmp.Enabled = True Then : SND("/wELEAM/z#" + astr + "/W(/cFireAmp[" + FireAmp.Text + "],WaterAmp[" + WaterAmp.Text + "],AirAmp[" + AirAmp.Text + "],EarthAmp[" + EarthAmp.Text + "],SpiritRes[" + SpiritAmp.Text + "]/W)") : MobData += Chr(13) + "ELEAM#" + astr + "(FireAmp[" + FireAmp.Text + "],WaterAmp[" + WaterAmp.Text + "],AirAmp[" + AirAmp.Text + "],EarthAmp[" + EarthAmp.Text + "],SpiritRes[" + SpiritAmp.Text + "])" : End If
        If SubFireRes.Enabled = True Then : SND("/wSELRE/z#" + astr + "/W(/cSubFireRes[" + SubFireRes.Text + "],SubWaterRes[" + SubWaterRes.Text + "],SubAirRes[" + SubAirRes.Text + "],SubEarthRes[" + SubEarthRes.Text + "],SubSpiritRes[" + SubSpiritRes.Text + "]/W)") : MobData += Chr(13) + "SELRE#" + astr + "(SubFireRes[" + SubFireRes.Text + "],SubWaterRes[" + SubWaterRes.Text + "],SubAirRes[" + SubAirRes.Text + "],SubEarthRes[" + SubEarthRes.Text + "],SubSpiritRes[" + SubSpiritRes.Text + "])" : End If
        If SubFireAmp.Enabled = True Then : SND("/wSELAM/z#" + astr + "/W(/cSubFireAmp[" + SubFireAmp.Text + "],SubWaterAmp[" + SubWaterAmp.Text + "],SubAirAmp[" + SubAirAmp.Text + "],SubEarthAmp[" + SubEarthAmp.Text + "],SubSpiritRes[" + SubSpiritAmp.Text + "]/W)") : MobData += Chr(13) + "SELAM#" + astr + "(SubFireAmp[" + SubFireAmp.Text + "],SubWaterAmp[" + SubWaterAmp.Text + "],SubAirAmp[" + SubAirAmp.Text + "],SubEarthAmp[" + SubEarthAmp.Text + "],SubSpiritRes[" + SubSpiritAmp.Text + "])" : End If
        If CheckBox1.Checked = True Then
            SND("/wMOUNT/z#" + astr + "/W(/c" + mountbag.Text + "," + mountspeed.Text + "," + mountlvlreq.Text + "," + MountCost1.Text + "S " + MountCost2.Text + "D " + MountCost3.Text + "V/W)")
            MobData += Chr(13) + "MOUNT#" + astr + "(" + mountbag.Text + "," + mountspeed.Text + "," + mountlvlreq.Text + "," + MountCost1.Text + "S " + MountCost2.Text + "D " + MountCost3.Text + "V)"
        End If
        If hp.Enabled = True Then
            SND("/wHITPO/z#" + astr + "/W(/c" + hp.Text + "/W)")
            MobData += Chr(13) + "HITPO#" + astr + "(" + hp.Text + ")"
            SND("/wWILLP/z#" + astr + "/W(/c" + wp.Text + "/W)")
            MobData += Chr(13) + "WILLP#" + astr + "(" + wp.Text + ")"
            SND("/wSTAMP/z#" + astr + "/W(/c" + sp.Text + "/W)")
            MobData += Chr(13) + "STAMP#" + astr + "(" + sp.Text + ")"
        End If
        If level.Enabled = True Then
            SND("/wLEVEL/z#" + astr + "/W(/c" + level.Text + "/W)")
            MobData += Chr(13) + "LEVEL#" + astr + "(" + level.Text + ")"
        End If
        SND("/wWEIGH/z#" + astr + "/W(/c" + MobileWeight.Text + "/W)")
        MobData += Chr(13) + "WEIGH#" + astr + "(" + MobileWeight.Text + ")"
        MobData += Chr(13) + "ENDMB#" + astr + "(" + comments.Text + "%p45)"
        If errornum = 0 Then
            If overwrite = True Then
                Dim tmp1 As Integer
                Dim tmp2 As Integer
                Dim tmp3 As Integer
                For tmp1 = 1 To Len(tmobdata) Step 1
                    If Mid(tmobdata, tmp1, 6 + Len(VIRID.Text)) = "VIRID#" + VIRID.Text Then
                        tmp2 = tmp1
                    End If
                    If Mid(tmobdata, tmp1, 6 + Len(VIRID.Text)) = "ENDMB#" + VIRID.Text Then
                        For tmp3 = tmp2 To Len(tmobdata) Step 1
                            If Mid(tmobdata, tmp3, 5) = "%p45)" Then
                                tmp3 += 7
                                Exit For
                            End If
                        Next
                        Exit For
                    End If
                Next
                SND("/GMob successfully overwritten.")
                MobData = Replace(tmobdata, Mid(tmobdata, tmp2 - 4, tmp3 - tmp2 + 2), LTrim(MobData))
            End If
            bAns = SaveTextToFile(MobData, Debugger.DirMobs, sErr)
            ComboBox1.Text = astr + ". " + MobName.Text + " (" + MobShort.Text + ")"
            If overwrite = False Then SND("/GMob has been added to database successfully.")
        Else
            SND("/R" + LTrim(Str(errornum)) + " Errors were found.")
            SND("/RMobile was not compiled or saved.")
        End If
    End Sub
    Private Sub SilentCarriage(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles comments.KeyPress, LookD.KeyPress, PathingBox.KeyPress
        Dim keyascii As Integer = AscW(e.KeyChar)
        Dim isnumber As Boolean = Char.IsNumber(e.KeyChar)
        Dim isletter As Boolean = Char.IsLetter(e.KeyChar)
        If keyascii = 13 Then
            e.Handled = True
        End If
    End Sub
    Private Sub MerchantWealthChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MWUnlimited.CheckedChanged
        If MWUnlimited.Checked = True Then
            MWSovern.Enabled = False
            MWDover.Enabled = False
            MWVern.Enabled = False
        Else
            MWSovern.Enabled = True
            MWDover.Enabled = True
            MWVern.Enabled = True
        End If
    End Sub
    Private Sub ChangedPathingType(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Path1.CheckedChanged, Path4.CheckedChanged, Path3.CheckedChanged, Path2.CheckedChanged
        If Path1.Checked = True Then
            P2Bttn.Enabled = False
            P3Bttn.Enabled = False
            PathingBox.Enabled = False
        ElseIf Path2.Checked = True Then
            P2Bttn.Enabled = True
            P3Bttn.Enabled = False
            PathingBox.Enabled = False
        ElseIf Path3.Checked = True Then
            P2Bttn.Enabled = False
            P3Bttn.Enabled = True
            PathingBox.Enabled = False
        ElseIf Path4.Checked = True Then
            P2Bttn.Enabled = False
            P3Bttn.Enabled = False
            PathingBox.Enabled = True
        End If
    End Sub
End Class